0

The following is an extract of an instruction manual:

If Java is reconfigured after SAV for Linux has already been installed, the JAVA_HOME value in /etc/Symantec.conf must be updated.
This can be done manually, or automatically by running /opt/Symantec/symantec_antivirus/update_java_home.sh

How do I run update_java_home.sh? What specific commands must I issue? What does the file extension .sh mean?

I am new to Linux and Ubuntu and would welcome detailed instructions on how to run update_java_home.sh

3 Answers 3

1

.sh is an extension for a shell script. A shell script is a file that is executed directly run by the "shell". For example, a .c file is compiled by the C compiler like gcc, Turbo C, etc. Similarly there are shells like bash, Bourne shell, etc which are also called as command-line interpreters which execute this .sh file. So, in order to run a .sh file, you can try any of the following at the terminal (the command-line interface) by first going to the directory in which the file is located:

1) For executing using a particular shell:

bash filename.sh

which is in your case:

bash update_java_home.sh

If you have installed Ubuntu, you should have bash by default.

2) For executing using the default shell:

chmod +x filename.sh

which is in your case

chmod +x update_java_home.sh

Here, chmod is a command to change the file permissions. +x gives executable rights to the user logged in, if permissible, upon the file given as filename.sh and then

./filename.sh

Here, a . indicates the path is the current directory and asks the shell to execute the file gives as filename. These are perhaps the most common methods used to execute shell scripts. There may be other methods too.

5
  • Great answer, +1 from me. I will only add that if .sh file exports some environment variables, they should be run like this: . filename.sh or source filename.sh if you want to export them for your session. I thought I should add this, may be useful. Dec 27, 2012 at 15:47
  • Oh yes, I forgot to mention about those, but anyways, the @n00b seems to just know about executing his file, so I am not editing it now. Thanks for the upvote :)
    – jobin
    Dec 27, 2012 at 15:50
  • @ Milan Todorovic and Jobin: Thanks guys for the awesome explanation :) You are both awesome.
    – n00b
    Dec 27, 2012 at 20:13
  • @ Milan Todorovic and Jobin: Just to let you know that I had to add the word "sudo" (without quotes) to the command "bash" (without quotes).
    – n00b
    Dec 28, 2012 at 3:38
  • Oh yes, if the file is located anywhere other than your /home/adnan path, you would need to add sudo, ie. superuser priviledge, to modify files(assuming your username is adnan)
    – jobin
    Dec 28, 2012 at 3:58
0

The file extension .sh means it is a shell script. If you dont know what a shell is you can read about it here. Any shell script file can be executed by typing its path (complete or relative) in shell and pressing enter:

adnan@laptop:~/>/some/path/script_name.sh
adnan@laptop:/some/path/>./script_name.sh

In your case the error is giving you complete path to the file update_java_home.sh. So just open Bash and write the following line

/opt/Symantec/symantec_antivirus/update_java_home.sh
1
  • @ binW: Thanks. What is "complete path"? "relative path"? Examples would be appreciated.
    – n00b
    Dec 27, 2012 at 14:51
0

Open a terminal and do the following.

To mark the file executable if it isn't already

chmod +x /opt/Symantec/symantec_antivirus/update_java_home.sh

then simply:

/opt/Symantec/symantec_antivirus/update_java_home.sh

1
  • @ Stephen Martin: Thanks. I shall try it and report back.
    – n00b
    Dec 27, 2012 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .