LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 07-04-2010, 12:56 AM   #1
MughalShahzad
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Rep: Reputation: 0
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
__________________
 
Old 07-04-2010, 01:42 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 453Reputation: 453Reputation: 453Reputation: 453Reputation: 453
Quote:
Originally Posted by MughalShahzad View Post
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/ ?
 
Old 07-04-2010, 12:47 PM   #3
Lagos
LQ Newbie
 
Registered: Jun 2010
Location: Las Cruces, NM
Distribution: MAC OSX 10.6.4 / Fedora 12
Posts: 11

Rep: Reputation: 8
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.
 
Old 07-13-2010, 11:26 PM   #4
MughalShahzad
LQ Newbie
 
Registered: Jul 2010
Posts: 3

Original Poster
Rep: Reputation: 0
Resoled

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

Thanks
Shahzad
 
  


Reply

Tags
java, jdk, jre, path


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Setting JAVA_HOME after automatic update of Java to the latest version BinDigit1 Linux - General 1 07-23-2009 07:21 PM
how to set java classpath on Redhat 9? antony_csf Programming 9 11-26-2004 06:48 AM
How to set CLASSPATH of java in Linux? vanhelsing Programming 1 08-23-2004 07:16 AM
I've set the CLASSPATH, but I still get a noClassDefFoundError. (Java) Travis86 Programming 6 02-05-2004 10:09 AM
How to set classpath for java jolly Linux - Software 3 04-22-2003 11:02 PM


All times are GMT -5. The time now is 03:00 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration