Forums Register Login

Can't compile a simple program.

+Pie Number of slices to send: Send
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 ]
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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!
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
 

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.
+Pie Number of slices to send: Send
Thanks Allen. Now I have a clear understanding about the environment variables.
World domination requires a hollowed out volcano with good submarine access. Tiny ads are optional.
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 744 times.
Similar Threads
Running Java Programs from the command prompt
gcc on linux
i cannot run my JBoss program
Package!
Compiling hello world java class uing ANT on eclipse
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 19:08:34.