?
Solved

Difference between PATH and JAVA_HOME?

Posted on 2003-03-10
9
Medium Priority
?
1,117 Views
Last Modified: 2010-05-18
Can anyone tell me the difference (if any) between setting your PATH variable to point to your jdk, and setting the JAVA_HOME to do the same thing? Does one take precedence over the other?

Thanks

Shawn
0
Comment
Question by:smyers2003
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 2

Expert Comment

by:antonsigur
ID: 8104363
This is not the same path
The setting the path environment is so your programs/compilers can run smoothly, like where ever you are you can always call java or javac, (not needing to type C:\javasdk\bin\java)

The JAVA_HOME tells where java are, C:\javasdk, so, java programs knows where to find jars and wich java to use (if you have multiple installs)

So:
the path must include: C:\javasdk\bin
and you must have JAVA_HOME=C:\javasdk

where javasdk is your installation

clear?
0
 

Expert Comment

by:sandip1981
ID: 8104365
yes both r same..........thats what i think .........as both looks for same thing........
cheers......
0
 

Expert Comment

by:sandip1981
ID: 8104394
yes both r same..........thats what i think .........as both looks for same thing........
cheers......
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Expert Comment

by:antonsigur
ID: 8104426
They aren't the same!!

one points to "bin" directory and the other to "installation directory" of your java installation
0
 
LVL 1

Expert Comment

by:pronane
ID: 8104523
the bin is where all the java components are stored:
such as
javac, java etc.
The other is the home directory of java i.e
where the base java directory is installed
so if you have java installed in the javajdk directory when you type java_home you would get

c:\jdk1.4
or if you have it installed in your temp directory on your c drive when u type java-home you would get:
c:\temp\jdk1.4

it points to the home directory think of unix when you think of home, where as setting the path is like setting the path for any application so that if you were to type java from a command line it would be able to recognise where java was as you have set the path as for example;
c:\jdk1.4\bin\
which contains the exe called java

i.e the path _TELLS_ your computer where the files are stored that you use to run java.
0
 

Author Comment

by:smyers2003
ID: 8104773
Thank you, everyone. So, if I set my PATH to point to C:\jdk1.2.2\bin, and then I set my JAVA_HOME to point to C:\j2sdk1.4.1_02, then my system will use the 1.2.2 JRE but point at the newest jars, components, etc. from the newest JDK (j2sdk1.4.1_02). Is that correct?
0
 
LVL 1

Expert Comment

by:pronane
ID: 8104872
yes that is correct it will point to 1.2.2.

No worries!
0
 
LVL 1

Accepted Solution

by:
pronane earned 150 total points
ID: 8104912
The best thing for you to do is test this out, make sure however its under a development machine you do it though, check your bin directory and you will see some of the following files:
javap.exe, jar.exe, javac.exe, java.exe appletviewer.exe etc, if you set your path i.e
in autoexec.bat or in windows xp you can do it through panel.
 
like such:  

set path = c:\jdk1.2.2\
it will use the java.exe file from the JDK 1.2.2 installation i.e this will use the apis from jdk1.2.2 not 1.4, if you do java_home it will give you the directory that you have java installed.
0
 

Author Comment

by:smyers2003
ID: 8104968
Thank you, Pronane, and I will accept your answer and hopefully you will get the 50 points....
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 5 hours left to enroll

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question