Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Javac Question

 
Amri Harimi
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For some reason I cant get my machine to compile from the command line using javac filename.java. I get a message that 'javac' is not recognized as an internal or external command.
I have installed VC4 Expert Edition and I downloaded Java VM and J2se 1.4.2 SDK.
How can I use javac???
 
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
Hi Amri,
Welcome to JavaRanch!
The j2sdk1.4.2/bin directory has to be named on your PATH environment variable. The precise details of setting your PATH depend on the OS, and aren't specific to Java; if you don't know how, see your OS documentation.
 
Vicken Karaoghlanian
Ranch Hand
Posts: 522
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Amri and welcome to the Ranch.
If you are on Win2k/XP then here is how:
1) Right-click on 'My Computer', then goto 'Properties'.
2) Under 'Advanced' tab, click on 'Environment Variables'.
3) Double click on the 'Path' variable (Under System variables).
4) Add the path in which the java compiler is located. In my case i added D:\j2sdk1.4.2\bin
5) Here is how my 'path' variable looks like
%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;D:\j2sdk1.4.2\bin
If you are on a different platform (Linux for example) then that would be another story.
Hope this helps.
 
Faisal Khan
Ranch Hand
Posts: 285
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;D:\j2sdk1.4.2\bin

I would recommend adding a new variable called JAVA_HOME and set the value of this variable as d:\j2sdk1.4.2 (or whatever your drive is) and then in the classpath change d:\j2sdk1.4.2\bin to %JAVA_HOME%\bin - This would help when it comes to changing the J2SDK version you are using and you will only need to update the JAVA_HOME variable.
HTH
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic