LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   How to get/set Java version, JAVA_HOME and Classpath (http://www.linuxquestions.org/questions/programming-9/how-to-get-set-java-version-java_home-and-classpath-817914/)

MughalShahzad 07-03-2010 11:56 PM

How to get/set Java version, JAVA_HOME and Classpath
 
I need step-by-step instructions on how to

1. check JAVA version,
2. set up the JAVA_HOME and
3. CLASSPATH variables


I had installed

1. NetbeansIDE 6.7.1 from Software Center
2. MySQL from command sudo apt-get install mysql-server
3. libmysql-java from synaptic package manager


OS Information

1. Partition 1, 3.0 GB Swap Space, /dev/sda1
2. Partition 2, 6.0 GB Filesystem, /dev/sda2 mount at /, Bootable
3. Partition 3, Ext4, /dev/sda3 mount at /home
4. Partition 4, /dev/sda4, Extended (Drive A, Drive B and Drive C)



Thanks & Regards
Shahzad
__________________

Sergei Steshenko 07-04-2010 12:42 AM

Quote:

Originally Posted by MughalShahzad (Post 4023265)
I need step-by-step instructions on how to

1. check JAVA version,
2. set up the JAVA_HOME and
3. CLASSPATH variables


I had installed

1. NetbeansIDE 6.7.1 from Software Center
2. MySQL from command sudo apt-get install mysql-server
3. libmysql-java from synaptic package manager


OS Information

1. Partition 1, 3.0 GB Swap Space, /dev/sda1
2. Partition 2, 6.0 GB Filesystem, /dev/sda2 mount at /, Bootable
3. Partition 3, Ext4, /dev/sda3 mount at /home
4. Partition 4, /dev/sda4, Extended (Drive A, Drive B and Drive C)



Thanks & Regards
Shahzad
__________________


http://java.sun.com/developer/online...etbeans_part1/ ?

Lagos 07-04-2010 11:47 AM

helpful commands
 
I found the following to be helpful when setting up java on Fedora Core 12:

The following command will print the version of java you are currently using.

> java -version

The following command will print the home directory for the java executables for the version of java you are running. I assume that this is what you will want to correspond to JAVA_HOME. I'm not a developer so I am not 100% sure on this. This is typically /usr/bin/java.

> which java

I think it might be best practice to create a sym link between your current version and the more generic path. For example:

>ln -s /usr/java/jre1.x.x.x /usr/java/jre

This saved me a bit of aggravation when I upgraded java. The only item I had to change was the first sym link. My PATH variable etc. is preserved.

The following sym link should also be in place to direct you to the correct executables:

>ln -s /usr/java/jre/bin/java /usr/bin/java

In the event that "/usr/bin" is *not* in the PATH variable (unlikely), the following command may be used to add it.

>PATH=/usr/bin:$PATH then export PATH

My understanding is that this will only stay put for the duration of the session. Editing the PATH variable as it exists in /etc/profile is a more permanent method.

I'm not sure how to set the class path, but I hope the above helps.

MughalShahzad 07-13-2010 10:26 PM

Resoled
 
No need to reply this post I had solved my problem.

Thanks
Shahzad


All times are GMT -5. The time now is 11:47 PM.