File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Cannot compile a java program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cannot compile a java program" Watch "Cannot compile a java program" New topic
Author

Cannot compile a java program

Subir Chetia
Greenhorn

Joined: Jan 26, 2001
Posts: 10
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

Joined: Jan 27, 2001
Posts: 19
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.


Manish
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
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).


"JavaRanch, where the deer and the Certified play" - David O'Meara
smriti singla
Greenhorn

Joined: Nov 14, 2000
Posts: 18
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Cannot compile a java program
 
Similar Threads
Assigning bytes to variables - confusion!
compilation error
Installing JDK in Windows 7
Selecting a JVM
Problem with JDK at command prompt