Like in windows, we will go to my computer --> properties(right click) ---> adavnced tab --> Environment variable and setting the classpath.
In Linux how we will be setting?
Scroll down for the Linux version
On Ubuntu, the best way to install Sun JDK 6, which will automatically set up your path correctly, is entering the command:
sudo apt-get install sun-java6-jdk
No, that won't help at all. That sets a CLASSPATH to a value which is unnecessary and will lose you access to your local files. It is also specific you your computer, and appears to have some errors, eg missing out .s.
Samir Kureshi wrote:try like this....
you should never set a permanent CLASSPATH if you can possibly help it. You should use the -cp flags on the "java" and "javac" tools, or put it in the manifest file. For the java and javac tools, look here, then look at the links on the right.
open terminal: gedit .bashrc
then append the following to the bottom of the file:
export JAVA_HOME=/<path to jdk>
this worked perfectly for me after I downloaded and compiled jdk binaries from sun website. Hope it helps you too.
There is a better way to install Java on a Debian-based Linux installation, which includes Ubuntu: Jesper Young told us here to use sudo apt-get install sun-java6-jdk which sets the PATH automatically. There is a similar instruction to update it.
An rpm-based Linux installation (eg Suse, Fedora) can use a similar instruction with the rpm tool.
The instructions to use export PATH in the .bashrc file should work for any "bash" terminal; Ubuntu and OpenSUSE and Fedora usually use "bash". You can probably find out which terminal you are using by giving a nonsense instruction to the terminal
And the name of the shell program appears as part of the error message
campbell@linux-747u:~> which bash
bash: oeirhglkcjxnvgiud: command not found