i know that i should use this to compile all the java classes . i used these and its working great. but i dont understand all of this . i did some readings and i understand now that when i use "set" , it sets the varibale name to the string after the equal sign. i know what lines 1 and 2 mean. but what about line 3, 4 and 5 !?:-/ can you please help explaning them to me ! thank you:)


1. set AGLET_HOME=C:\Users\MARIA\Desktop\aglets

2. set JDK_HOME=C:\Users\MARIA\Java\jdk1.6.0_18

3. set CLASSPATH=.

4. set CLASSPATH=%CLASSPATH%;%AGLET_HOME%\lib\myJarFile.jar

5. %JDK_HOME%\bin\javac -d %AGLET_HOME%\public -classpath %CLASSPATH% *.java

When Java needs to load a class it gets the variable "CLASSPATH", which should contain a list of directories and/or jar files, and searches all those locations to find the .class file(s).
Line 4 appends %AGLET_HOME%\lib\myJarFile.jar to the CLASSPATH variable.
AGLET_HOME was set to C:\Users\MARIA\Desktop\aglets, so line 4 appends the jar file
C:\Users\MARIA\Desktop\aglets\lib\myJarFile.jar
to the CLASSPATH, so java will be able to find whatever classes are stored in that jar.

maybe would be better search for

varName = System.getProperty("SystemEnviromentAsString");

@ Mr. James: Thank you for replying, i understand better now. but i still have a question. when im writing this in the commad prompt :

C:\Users\MARIA\Desktop\%JDK_HOME%\bin\javac -d %AGLET_HOME%\public -classpath %CLASSPATH% *.java

the line above is supposed to compile ALL THE JAVA CLASSES ON THE DESKTOP. RIGHT?

i have a folder called: "JCode" placed on the desktop, how come when i run the above commands, the java classes IN THE JCODE folder gets compiled too ??

Compiles all the .java files in the current directory (*.java) - is that the desktop?
Is the JCODE folder in the classpath?

the current directory is the desktop, and JCODE folder is on the desktop. but i didnt not included in the class path ! below is what im doing

1. set AGLET_HOME=C:\Users\MARIA\Desktop\aglets

2. set JDK_HOME=C:\Users\MARIA\Java\jdk1.6.0_18

3. set CLASSPATH=.

4. set CLASSPATH=%CLASSPATH%;%AGLET_HOME%\lib\myJarFile.jar

5. C:\Users\MARIA\Desktop\%JDK_HOME%\bin\javac -d %AGLET_HOME%\public -classpath %CLASSPATH% *.java

The other thing that comes in here is the Java package structure - so if one of your desktop .java files imports (for example) jcode.SomeClass, then the compiler will search for a jcode directory in the classpath and look inside there for SomeClass.class or SomeClass.java. If it only finds the .java it will compile it.
See http://download.oracle.com/javase/1.4.2/docs/tooldocs/windows/javac.html - in particular the section headed "SEARCHING FOR TYPES".

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.