• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Can't compile a simple program.

 
Ram Ganesan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ram Ganesan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Jeff Bosch
Ranch Hand
Posts: 805
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
Ram Ganesan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Chris Allen
Ranch Hand
Posts: 127
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ram Ganesan
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Allen. Now I have a clear understanding about the environment variables.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic