|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
JAVA_HOME vs Classpath
I am very confused about the environment variables in Java:
Please comment the following questions: 1. Is the point with the classpath to define the folder containing the java.exe and javac.exe files in order to be able to just write "java" and "javac" (and thus not the entire filepath - C:\Java\j2sdk_nb\j2sdk1.4.2\bin\java(c) myfile) when compiling and running java programs? 2. What does the JAVA_HOME environment variable do and what is the purpose with it? 3. Do I need to add to the classpath every folder (and path) where I have created my own java classes? Any help much appreciated!! |
|
#2
|
|||||
|
|||||
|
I found the following in the "Apache Tomcat Bible" from
Eaves, Jones & Godfrey. Quote:
In "Java, how to program, 6th edition" from Deitel, the authors show how you can edit these variables using the system properties dialog by right clicking My Computer. But the purpose is the same : Quote:
Mind you, Deitel shows you should add the complete path c:\Program Files\Java\jdk1.5.0\bin to the PATH variable. So, there is no need to use the JAVA_HOME variable. And why is that ? Well, as Deitel indicates : Quote:
Now, about adding to the classpath every folder in which you have created your classes. Well, I'm only in java web applications; I've never written any java applications using Swing or AWT. I'm using Tomcat as web server and I've never had to add the folders containing my classes to the PATH variable. I just let Tomcat know which web applications are available and he does the rest. So, I guess this could be similar for java applications. |
|
#3
|
|||
|
|||
|
Java_HOME is where you put most of your jar files, so you don't have to repeat the same basic path in class path. class path is where you put all jar files you'll use.
|
|
#4
|
|||
|
|||
|
Okay
Quote:
Well I thought the .jar files were supposed to be put in the C:\Java\j2sdk1.4.2\jre\lib\ext folder? That works equally well, doesn't it? Marius |
|
#5
|
|||
|
|||
|
Problemts prevail
I thank you for your efforts, but the problem remains the same; I need to spell out the entire filepath to my java.exe and java.exec file to be able to compile and rund java programs.
This is really annoying, and happens even though I have tried all sorts of combinations for the environment variables JAVA_HOME, PATH and CLASSPATH. It shouldn't matter that I cofigure the USER variable and not the SYSTEM variable, right?? Marius |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Java Development > JAVA_HOME vs Classpath |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|