aspose file tools*
The moose likes Beginning Java and the fly likes javac is not recognized? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "javac is not recognized?" Watch "javac is not recognized?" New topic
Author

javac is not recognized?

Shannon Sims
Ranch Hand

Joined: Jul 03, 2003
Posts: 197
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

Joined: Jul 22, 2000
Posts: 9052
    
  12
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 ]

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

    Joined: Jun 12, 2003
    Posts: 28
    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

    Joined: Jul 03, 2003
    Posts: 197
    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

    Joined: May 05, 2000
    Posts: 13974
    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.


    Associate Instructor - Hofstra University
    Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
    Thomas Paul
    mister krabs
    Ranch Hand

    Joined: May 05, 2000
    Posts: 13974
    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

    Joined: Jul 03, 2003
    Posts: 197
    Hi Thomas,
    Ahhh..., got it! I'm ready to start coding.
    Thanks everyone!
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: javac is not recognized?