Hello Gang, I recently downloaded the latest version of J2SE SDK [c:/j2sdk1.4.2_02] and also updated the environmental variables and path as shown in thisweb page. Then I wrote a simple "Hello World" program [c:/Hello.java] and tried to compile it from the command line. It just wouldn't. It says: 'javac' is not recognized as an internal or external command, operable program or batch file. Is it something that I missed? Karthik. [ November 10, 2003: Message edited by: Karthik Ganesan ]
That web page neglects to mention that changes to environment variables aren't recognized by already-running programs. You have to opejn a brand new command window to see the new values. If it still doesn't work, you may have made a typing error. The components of the PATH are separated by semicolons, with no spaces; and make sure the JAVA_HOME you set accurately reflects where your JDK was actually installed.
Thanks for the reply. One more thing.... Actually, I set up a user variable ('Path') with value ('C:\j2sdk1.4.2_02\bin')...and the program compiled!! I want to know the basic difference b/w user variable and system variable. P.S: The system variable ('Path') still has the %JAVA_HOME%\bin value as shown in the web page given above. Can I leave it as it is or remove it?
You could always comment it out and see how that affects your compilation and runtime. If it has no effect, you didn't need it, and you can leave it commented out. Hope that helps!
Give a man a fish, he'll eat for one day. <br />Teach a man to fish, he'll drink all your beer.<br /> <br />Cheers,<br /> <br />Jeff (SCJP 1.4, SCJD in progress, if you can call that progress...)
Joined: Nov 08, 2003
Jeff, I did as you said and it worked. As for the program, being very small and simple, there wasn't much difference in compiling and running. I still would like to know the difference b/w setting up path as user variable and system variable and also what, in general, environment variables are for.
difference b/w setting up path as user variable and system variable and also what, in general, environment variables are for
User variables are specific to a particular user (i.e. Under Windoze, if Joe is signed on, the variable is available to him but not if Sue is signed on. System variables are available regardless of who is signed on. Environment variables are just that; they are there for the "environment" to work properly/easily. One of these environment variables is the PATH variable. For example: PATH=c:\windows;c:\windows\system32 (and so on) If you open a dos window and type 'notepad' (without the single quotes), it will open the notepad application, regardless of the directory you are in.
Joined: Nov 08, 2003
Thanks Allen. Now I have a clear understanding about the environment variables.