Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1342
  • Last Modified:

Difference between PATH and JAVA_HOME?

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
smyers2003
Asked:
smyers2003
  • 3
  • 2
  • 2
  • +1
1 Solution
 
antonsigurCommented:
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
 
sandip1981Commented:
yes both r same..........thats what i think .........as both looks for same thing........
cheers......
0
 
sandip1981Commented:
yes both r same..........thats what i think .........as both looks for same thing........
cheers......
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
antonsigurCommented:
They aren't the same!!

one points to "bin" directory and the other to "installation directory" of your java installation
0
 
pronaneCommented:
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
 
smyers2003Author Commented:
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
 
pronaneCommented:
yes that is correct it will point to 1.2.2.

No worries!
0
 
pronaneCommented:
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
 
smyers2003Author Commented:
Thank you, Pronane, and I will accept your answer and hopefully you will get the 50 points....
0

Featured Post

Technology Partners: 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!

  • 3
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now