Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot compile a java program

 
Subir Chetia
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I cannot compile a java program. I have all the latest versions of jdk 1.3,jdk 1.2, jsdk, MSVM, installed on my pc. Even when I type "Dir:\jdk1.3\bin\javac filename.java" the program does not get compiled.
 
Manish Malik
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Subir Chetia:
I cannot compile a java program. I have all the latest versions of jdk 1.3,jdk 1.2, jsdk, MSVM, installed on my pc. Even when I type "Dir:\jdk1.3\bin\javac filename.java" the program does not get compiled.

Hi,
Although this is a minor error, still please check that you have location of JAVAC.EXE and JAVA.EXE in your PATH variable. Also, the CLASSPATH variable is properly set, and ensure you are using the command "javac filename.java" to compile.

------------------
Manish.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I seriously doubt if you put the filename.java in the bin directory with the downloaded stuff.
As stated above the PATH variable tell the operating system where to search for the downloaded stuff that has javac in it, and where to find the .java files. So it needs to include the \bin directory and the directory where you are keeping the source.
The CLASSPATH tells the operating system where to look to find the compiled classes to execute. So it needs to include the \bin directory and the directory where you are keeping the .class files (I keep them in the same directory with my .java files for simplicity at home, but at work we keep them separate).
 
smriti singla
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello
u can set ur path in autoexec.bat file as dir:\jdk1.3;dir:\jdk1.3\bin; This will help u and u need not to bother about path each and every time u will compile ur program.to compile it just use command "javac filename.java".also be sure that u are in the same directory where ur .java file is placed on command prompt.
Smriti Singla
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic