File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

javac is not recognized?

 
Shannon Sims
Ranch Hand
Posts: 197
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,
Can someone please help me? When I try to execute the HelloWorld.java I receive the following error message:
'javac' is not recognized as an internal or external command, operable program or batch file.
My autoexec.bat is as follows:
classpath=c:\j2sdk1.4\lib;.;c:\Java
path=c:\j2sdk1.4\bin;c:\j2sdk1.4\jre\bin
The HelloWorld.java file is located under c:\Java.
I installed the Java2sdk1.4_1.04 (version 1.04), could this be the problem?
Thanks!
 
Marilyn de Queiroz
Sheriff
Posts: 9059
12
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I try to execute the HelloWorld.java I receive the following error message:
'javac' is not recognized as an internal or external command, operable program or batch file.
My autoexec.bat is as follows:
classpath=c:\j2sdk1.4\lib;.;c:\Java
path=c:\j2sdk1.4\bin;c:\j2sdk1.4\jre\bin

The HelloWorld.java file is located under c:\Java.

I installed the Java2sdk1.4_1.04 (version 1.04), could this be the problem?

This page may help you get started. But just a couple of quick things.
  • You compile the code with "javac HelloWorld.java
  • You execute the program with "java HelloWorld"

  • You seem to be confusing javac with execution.

    Based on the error you listed above, you seem to have an error in your path. If you look in the c:\j2sdk1.4\bin subdirectory, do you see a file named javac.exe?

    Some people have accidentally downloaded only the JRE rather than the J2SDK. Since the JRE doesn't have a javac.exe file, this causes an error when they try to compile their code. Java2sdk1.4_1.04 should work just fine.
    [ July 31, 2003: Message edited by: Marilyn de Queiroz ]
     
    Paul Zill
    Greenhorn
    Posts: 28
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    try typing "set path" from the command line.
    does the java bin directory correctly appear?
    if it does make sure you don't have a typo.
    double check your autoexec.bat and try restarting your machine again.
    BTW are you running on win95/98/me?
     
    Shannon Sims
    Ranch Hand
    Posts: 197
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Marilyn, Hi Paul,
    Thanks for the help so far. In answer to Marilyn's question, c:\j2sdk1.4\bin subdirectory does contain the javac.exe. I tried compiling HelloWorld.java within this directory since this is where the javac.exe resides. Like so:
    c:\j2sdk1.4\bin javac HelloWorld.java
    still no luck, however I received a different error:
    error: cannot read: HelloWorld.java
    1 error
    then I also tried:
    c:\j2sdk1.4\bin javac c:\Java\HelloWorld.java
    this time, nothing occurred. The dos prompt display again.
    Just so there's no question about the HelloWorld.java code, I copied the example from the Cattle Drive page, so there should be any errors.
    To answer Paul's question, when I typed "set path" on the command line I only see Path="a bunch of other stuff" and then I see "c:\java\bin" which is odd, since my autoexec.bat file displays the following:
    classpath=c:\j2sdk1.4\lib;.;c:\Java
    path=c:\j2sdk1.4\bin;c:\j2sdk1.4\jre\bin
    ( no typo's either )
    I'm using Windows2000.
    Thanks!!!
     
    Thomas Paul
    mister krabs
    Ranch Hand
    Posts: 13974
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    if you are using win2k you should be setting your path from the control panel and not from the autoexec.bat
    By the way, the time that nothing happened when you typed javac is a good thing. If there are no errors then you should just get the dos prompt back.
     
    Thomas Paul
    mister krabs
    Ranch Hand
    Posts: 13974
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    if you are using win2k you should be setting your path from the control panel and not from the autoexec.bat
    %0
     
    Shannon Sims
    Ranch Hand
    Posts: 197
    • 0
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    Hi Thomas,
    Ahhh..., got it! I'm ready to start coding.
    Thanks everyone!
     
    I agree. Here's the link: http://aspose.com/file-tools
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic