wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Problems compiling with DOS! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problems compiling with DOS!" Watch "Problems compiling with DOS!" New topic
Author

Problems compiling with DOS!

Waria Ahmed
Ranch Hand

Joined: Jul 09, 2008
Posts: 56
I�m trying to compile a file using DOS but I keep getting the error message �javac is not recognized as an internal or external command, operable program or batch file�

How do I get around to fixing this problem, I have installed JDK1.4, and followed the instructions, but maybe I haven�t set the class path right?

Any tips for a beginner?
Rajkumar balakrishnan
Ranch Hand

Joined: May 29, 2008
Posts: 445

Just right click on MyComputer goto Properties..Click the Advanced Tab..and click the Environment Variables button..Click New button under UserVariable option then set the name as JAVA_HOME and value as /home/where/your/jdk_is/..
Then try to compile the program..it works..If you still face then just navigate to your bin folder of jdk and try compile your program....


Never try to be a hard-worker. Be a smart-worker.
My Blog
Rajkamal Pillai
Ranch Hand

Joined: Mar 02, 2005
Posts: 443
    
    1

Hi,

The PATH environment variable needs to contain the Jdk/bin folder.

Cheers,
Raj.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38357
    
  23
Very common problem; we have all had it.
Why are you using Java1.4.2, which was superseded nearly 4 years ago? Go back to the Sun website and download the latest stable version, which came out this week, and you will find it called JDK 6 update 7.
Install that as usual, and as you go, watch very closely for the name of the folder Windows installs it into. It says "Install into C:\Program Files\java\jdk1.6.0_07 or choose another folder" and most people use the default option, but remember the name of the folder.

Now navigate to this page in the Java Tutorials and you will see your problem at the top of the page. Read that. You see you have to update your PATH variable. On the page there is a link to the installation instructions. It says "update the PATH variable (optional)". Never mind about "optional"; do exactly what it says about updating PATH permanently. There is no need to do anything with the classpath.
Remember:
  • The PATH variable you want begins with C: (usually) and ends with bin (always).
  • The tiniest spelling error will stop it working.
  • Your computer will find the "javac.exe" program in the first Java folder it finds in the PATH, so it is best only to have one Java folder in the PATH.
  • Marilyn de Queiroz
    Sheriff

    Joined: Jul 22, 2000
    Posts: 9044
        
      10
    Originally posted by Campbell Ritchie:
    Why are you using Java1.4.2, which was superseded nearly 4 years ago?

    I think you'd be surprised at how many companies are still using Java1.4.2.


    JavaBeginnersFaq
    "Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
    marc weber
    Sheriff

    Joined: Aug 31, 2004
    Posts: 11343

    Originally posted by Marilyn de Queiroz:
    ...I think you'd be surprised at how many companies are still using Java1.4.2.

    Or even earlier!


    "We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
    sscce.org
    Campbell Ritchie
    Sheriff

    Joined: Oct 13, 2005
    Posts: 38357
        
      23
    Yes, I'd forgotten there are still people on Java1.4.
     
     
    subject: Problems compiling with DOS!