path problem: Windows can't find compiler or java.. - Java

This is a discussion on path problem: Windows can't find compiler or java.. - Java ; I could swear when I first installed jdk 1.5 in my new machine (Vista Ultimate) about three months ago, I put path to 'bin' dir in java installation in 'path' Windows env variable, and made sure I was able to ...

+ Reply to Thread
Results 1 to 10 of 10

path problem: Windows can't find compiler or java..

  1. Default path problem: Windows can't find compiler or java..

    I could swear when I first installed jdk 1.5 in my new machine (Vista
    Ultimate) about three months ago, I put path to 'bin' dir in java
    installation in 'path' Windows env variable, and made sure I was able to
    both compile and run classes; however, when I tried to compile or run a
    class today, I got in trouble....

    when I try to compile a .java file I get this error:

    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    when I try to run a class I get told

    Error: could not open `C:\Program
    Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'

    this is path to dir 'bin' in my java installation:

    C:\Java\jdk1.5.0_12\jre\bin;

    so put this again in path, then restarted machine... but I still get
    same errors when try to compile or run classes..

    thank you..

  2. Default Re: path problem: Windows can't find compiler or java..

    maya wrote:
    > I could swear when I first installed jdk 1.5 in my new machine (Vista
    > Ultimate) about three months ago, I put path to 'bin' dir in java
    > installation in 'path' Windows env variable, and made sure I was able to
    > both compile and run classes; however, when I tried to compile or run a
    > class today, I got in trouble....
    >
    > when I try to compile a .java file I get this error:
    >
    > 'javac' is not recognized as an internal or external command,
    > operable program or batch file.
    >
    > when I try to run a class I get told
    >
    > Error: could not open `C:\Program
    > Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'
    >
    > this is path to dir 'bin' in my java installation:
    >
    > C:\Java\jdk1.5.0_12\jre\bin;
    >
    > so put this again in path, then restarted machine... but I still get
    > same errors when try to compile or run classes..


    I'm going to pretend there's an environment variable

    JAVA_HOME=C:/Java/jdk1.5.0_12

    BTW, there's a big security hole in jdk1.5.0_12. You should upgrade to
    jdk1.5.0_13 right away.

    The compiler, javac.exe, isn't in %JAVA_HOME%/jre/bin/, what you put in your
    PATH, it's in %JAVA_HOME%/bin/, not yet in your PATH.

    Have you any idea why your execution of java.exe was trying to open
    "C:/Program Files/Java/jre1.5.0_12/lib/i386/jvm.cfg"? Does that file exist?
    Does even its directory?

    Why is that path through "C:/Program Files/" when your JAVA_HOME isn't?

    --
    Lew

  3. Default Re: path problem: Windows can't find compiler or java..

    Lew wrote:
    > maya wrote:
    >> I could swear when I first installed jdk 1.5 in my new machine (Vista
    >> Ultimate) about three months ago, I put path to 'bin' dir in java
    >> installation in 'path' Windows env variable, and made sure I was able
    >> to both compile and run classes; however, when I tried to compile or
    >> run a class today, I got in trouble....
    >>
    >> when I try to compile a .java file I get this error:
    >>
    >> 'javac' is not recognized as an internal or external command,
    >> operable program or batch file.
    >>
    >> when I try to run a class I get told
    >>
    >> Error: could not open `C:\Program
    >> Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'
    >>
    >> this is path to dir 'bin' in my java installation:
    >>
    >> C:\Java\jdk1.5.0_12\jre\bin;
    >>
    >> so put this again in path, then restarted machine... but I still get
    >> same errors when try to compile or run classes..

    >
    > I'm going to pretend there's an environment variable
    >
    > JAVA_HOME=C:/Java/jdk1.5.0_12


    yes there is.. (and Tomcat, which uses that variable, is running fine..)

    > BTW, there's a big security hole in jdk1.5.0_12. You should upgrade to
    > jdk1.5.0_13 right away..


    ok, I will.. thank you..

    > The compiler, javac.exe, isn't in %JAVA_HOME%/jre/bin/, what you put in
    > your PATH, it's in %JAVA_HOME%/bin/, not yet in your PATH.


    ok, now set path to C:\Java\jdk1.5.0_12\bin, can compile classes but not
    run them.. (i.e., can find javac, but not java.. but this 'bin' dir
    does contain both java and javac...) when try to run class I just
    compiled still get this error:

    Error: could not open `C:\Program Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'

    > Have you any idea why your execution of java.exe was trying to open
    > "C:/Program Files/Java/jre1.5.0_12/lib/i386/jvm.cfg"?


    I have no idea.. there isn't even a 'Java' dir inside C:\Program Files..

    thank you..


  4. Default Re: path problem: Windows can't find compiler or java..

    maya wrote:
    > ok, now set path to C:\Java\jdk1.5.0_12\bin, can compile classes but not
    > run them.. (i.e., can find javac, but not java.. but this 'bin' dir


    That is not your error.

    > does contain both java and javac...) when try to run class I just
    > compiled still get this error:
    >
    > Error: could not open `C:\Program Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'


    This error has absolutely nothing to do with not being able to find java.exe.

    >> Have you any idea why your execution of java.exe was trying to open
    >> "C:/Program Files/Java/jre1.5.0_12/lib/i386/jvm.cfg"?

    >
    > I have no idea.. there isn't even a 'Java' dir inside C:\Program Files..


    Figure that out and you've solved your problem.

    Because there is not a Java dir inside "Progam Files" is why you get the
    error; the program is trying to find that directory in order to find that
    file. When the search for that file fails (because it doesn't exist), you get
    the error.

    Look over all your envars and make sure there's nothing pointing to that
    fictitious directory. Java looks for a jvm.cfg in its
    %JRE_HOME%/lib/<architecture>/ directory. Something is telling Java to look
    in that nonexistent directory for itself.

    For example, on my Linux system I have JAVA_HOME=/usr/java/java, and
    JRE_HOME=/usr/java/java/jre, and jvm.cfg in
    /usr/java/java/jre/lib/i386/jvm.cfg a.ka. $JRE_HOME/lib/i386/jvm.cfg .

    Do you have a JRE_HOME envar?

    --
    Lew

  5. Default Re: path problem: Windows can't find compiler or java..

    Lew wrote:
    > maya wrote:
    >> ok, now set path to C:\Java\jdk1.5.0_12\bin, can compile classes but
    >> not run them.. (i.e., can find javac, but not java.. but this 'bin' dir

    >
    > That is not your error.
    >
    >> does contain both java and javac...) when try to run class I just
    >> compiled still get this error:
    >>
    >> Error: could not open `C:\Program
    >> Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'

    >
    > This error has absolutely nothing to do with not being able to find
    > java.exe.
    >
    >>> Have you any idea why your execution of java.exe was trying to open
    >>> "C:/Program Files/Java/jre1.5.0_12/lib/i386/jvm.cfg"?

    >>
    >> I have no idea.. there isn't even a 'Java' dir inside C:\Program Files..

    >
    > Figure that out and you've solved your problem.
    >
    > Because there is not a Java dir inside "Progam Files" is why you get the
    > error; the program is trying to find that directory in order to find
    > that file. When the search for that file fails (because it doesn't
    > exist), you get the error.


    and why is it looking for 'java' there when I have it in the path??

    > Look over all your envars and make sure there's nothing pointing to that
    > fictitious directory. Java looks for a jvm.cfg in its
    > %JRE_HOME%/lib/<architecture>/ directory. Something is telling Java to
    > look in that nonexistent directory for itself.


    just looked in all system env vars.. didn't find any path in any setting
    containing "C:/Program Files/Java".....

    > For example, on my Linux system I have JAVA_HOME=/usr/java/java, and
    > JRE_HOME=/usr/java/java/jre, and jvm.cfg in
    > /usr/java/java/jre/lib/i386/jvm.cfg a.ka. $JRE_HOME/lib/i386/jvm.cfg .
    >
    > Do you have a JRE_HOME envar?


    no, I don't.. I have never needed one... oh brother... ok... thank
    you...


    >


  6. Default Re: path problem: Windows can't find compiler or java..

    Lew wrote:
    >> Because there is not a Java dir inside "Progam Files" is why you get
    >> the error; the program is trying to find that directory in order to
    >> find that file. When the search for that file fails (because it
    >> doesn't exist), you get the error.


    maya wrote:
    > and why is it looking for 'java' there when I have it in the path??


    It's not, as I mentioned. This is not "looking for 'java' there" nor a PATH
    issue.

    --
    Lew

  7. Default Re: path problem: Windows can't find compiler or java..

    Lew wrote:
    > Lew wrote:
    >>> Because there is not a Java dir inside "Progam Files" is why you get
    >>> the error; the program is trying to find that directory in order to
    >>> find that file. When the search for that file fails (because it
    >>> doesn't exist), you get the error.

    >
    > maya wrote:
    >> and why is it looking for 'java' there when I have it in the path??

    >
    > It's not, as I mentioned. This is not "looking for 'java' there" nor a
    > PATH issue.


    hmmmmm... I swear I'm stumped here.. over the last four years or so I
    have installed java sdk in more than one machine, both at home and work,
    I have never had this problem..

    thank you...



  8. Default Re: path problem: Windows can't find compiler or java..

    maya wrote:
    > hmmmmm... I swear I'm stumped here.. over the last four years or so I
    > have installed java sdk in more than one machine, both at home and work,
    > I have never had this problem..


    Perhaps there is a FUBARed registry entry causing your
    > Error: could not open
    > `C:\Program Files\Java\jre1.5.0_12\lib\i386\jvm.cfg'


    I find it significant that this is not a JDK but a regular JRE path. A JDK
    path would have "jdkblahblah/jre" instead of "jreblahblah".

    Is there a JRE separate from the JDK listed in your Control Panel "Add/Remove
    Software" list?

    Since Java version 1.5.0_12 has a major security flaw, I suggest you install
    JDK 1.5.0_13, completely uninstall 1.5.0_12, and see if that doesn't erase
    your difficulty.

    If your Windows registry is out of whack, you're due for interesting times.
    I've had luck from time to time using regedit to search for such anomalous
    entries as might be in play here. Freeware products like Spybot Search &
    Destroy, free of charge from
    <http://www.safer-networking.org/> (beware of imitations)
    and their RegAlyzer product help with this, as does AdAware
    <http://www.lavasoft.com/>
    who have a free version in addition to the for-pay versions.

    Make sure you set a registry savepoint before treading on such dangerous ground.

    --
    Lew

  9. Default Re: path problem: Windows can't find compiler or java..

    On Sun, 07 Oct 2007 17:31:08 -0400, maya <maya778899@yahoo.com> wrote,
    quoted or indirectly quoted someone who said :

    > C:\Java\jdk1.5.0_12\jre\bin;
    >
    >so put this again in path, then restarted machine... but I still get
    >same errors when try to compile or run classes..


    I see two problems.

    1. You have an out of date JRE. See
    http://mindprod.com/jgloss/jre.html

    2. you want to put the JDK dir on the path not the JRE.
    see http://mindprod.com/jgloss/jdk.html


    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com

  10. Default Re: path problem: Windows can't find compiler or java..

    On Sat, 13 Oct 2007 10:12:42 GMT, Roedy Green
    <see_website@mindprod.com.invalid> wrote, quoted or indirectly quoted
    someone who said :

    >
    >I see two problems.
    >
    >1. You have an out of date JRE. See
    >http://mindprod.com/jgloss/jre.html
    >
    >2. you want to put the JDK dir on the path not the JRE.
    >see http://mindprod.com/jgloss/jdk.html


    the JRE java.exe does not need to be on the path since it uses a trick
    to find java.exe. However JavaC.exe does need to be on the path.
    --
    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com

+ Reply to Thread

Similar Threads

  1. Graph - find a path from A to B with path constraints
    By Application Development in forum Theory
    Replies: 2
    Last Post: 07-02-2007, 01:30 AM
  2. how does windows find java.exe?
    By Application Development in forum Java
    Replies: 9
    Last Post: 06-28-2007, 09:46 AM
  3. Graph - find a path from A to B with path constraints
    By Application Development in forum Theory
    Replies: 1
    Last Post: 05-30-2007, 02:26 AM
  4. Language features for compiler writing was: Java compiler courses
    By Application Development in forum Functional
    Replies: 9
    Last Post: 05-04-2007, 12:21 PM
  5. New version of JACCIE (Java-based Compiler Compiler)
    By Application Development in forum Compilers
    Replies: 0
    Last Post: 09-03-2004, 11:41 AM