Info - com.sun.tools.javac.Main is not on the classpath

Discussion in 'Java' started by Andrew Thompson, Jul 22, 2006.

  1. For information only - no question here..

    I hit this error and went searching the groups for answers.
    Failed to find the solution to this particular problem, so
    I thought I'd post the fix to this (particularly stupid)
    mistake I made.

    When compiling from the command line, I might set
    JAVA_HOME like this.

    >set JAVA_HOME="C:\Program Files\Java\j2sdk1.5.0\"


    Note that the " are required because of the space
    in the name of 'Program Files'.

    Very soon I got sick of typing that every time, and
    put it as an environment variable using regedit.

    Key: JAVA_HOME
    Value: "C:\Program Files\Java\j2sdk1.5.0\"

    This seems to work when referenced from the command
    line or .BAT files, but most IDE's and Ant are tripped up
    by it. The quotes now cause the string to fail to find the
    tools.jar (which is in the lib\ subdirectory of the SDK).

    It should be something more like (adjust for local system)..

    Key: JAVA_HOME
    Value: C:\Program Files\Java\j2sdk1.5.0\

    After removing the extraneous quote marks,
    (and rebooting), it worked just fine.

    ( Hopefully - next time I forget this fix, stuff it up
    again and come looking for answers, I'll *find* this
    again.. ;)

    Andrew T.
    Andrew Thompson, Jul 22, 2006
    #1
    1. Advertising

  2. Andrew Thompson

    lordy Guest

    On 2006-07-22, Andrew Thompson <> wrote:
    >
    > When compiling from the command line, I might set
    > JAVA_HOME like this.
    >
    >>set JAVA_HOME="C:\Program Files\Java\j2sdk1.5.0\"

    >
    > Note that the " are required because of the space
    > in the name of 'Program Files'.


    Yes. The quotes are required *by the DOS shell*.

    Not sure what OS you are using but you can set env.vars
    under (from memory) Control Panel->System-> Performance
    or something like that
    then there is a tab called Environmental Variables. Which
    then presents a piss-poor dialog to enter your variables.
    (But still a bit safer than firing up regedit)

    However I have generally preferred not setting JAVA_HOME here
    if I have multiple java based applications, but making sure they
    each set their own JAVA_HOME independently in their own config files.

    Lordy
    lordy, Jul 22, 2006
    #2
    1. Advertising

  3. lordy wrote:
    > On 2006-07-22, Andrew Thompson <> wrote:
    > >
    > > When compiling from the command line, I might set
    > > JAVA_HOME like this.
    > >
    > >>set JAVA_HOME="C:\Program Files\Java\j2sdk1.5.0\"

    > >
    > > Note that the " are required because of the space
    > > in the name of 'Program Files'.

    >
    > Yes. The quotes are required *by the DOS shell*.
    >
    > Not sure what OS you are using but you can set env.vars
    > under (from memory) Control Panel->System-> Performance
    > or something like that
    > then there is a tab called Environmental Variables.


    XP Pro, and ..checking

    Settings | Control Panel | System | Advanced |
    Environment Variables | (System Variables) New

    >....Which
    > then presents a piss-poor dialog to enter your variables.
    > (But still a bit safer than firing up regedit)


    I reckon running regedit is almost as safe as
    'home brain sugery'.

    > However I have generally preferred not setting JAVA_HOME here
    > if I have multiple java based applications, but making sure they
    > each set their own JAVA_HOME independently in their own config files.


    Good point. I generally prefer that myself, but
    there are times/situations that the 'set and forget'
    nature of enviroment variable can save a lot time.
    OTOH, this example illustrates one of those
    /other/ times when several hours is wasted in
    tracking down the trivial mistake.

    Andrew T.
    Andrew Thompson, Jul 22, 2006
    #3
  4. Andrew Thompson

    ge0rge Guest

    Andrew Thompson wrote:
    ....
    >>>>set JAVA_HOME="C:\Program Files\Java\j2sdk1.5.0\"
    >>>
    >>>Note that the " are required because of the space
    >>>in the name of 'Program Files'.

    >>
    >>Yes. The quotes are required *by the DOS shell*.


    install the jdk on C: drive and it will create c:\j2sdk1.5.0\ directory and you
    get rid of the potential space problem in the directory name once and for all.

    --
    What nonsense people talk about happy marriages! A man can be happy with
    any woman so long as he doesn't love her.
    -- Oscar Wilde
    ge0rge, Jul 22, 2006
    #4
  5. Andrew Thompson

    IchBin Guest

    ge0rge wrote:
    > Andrew Thompson wrote:
    > ...
    >>>>> set JAVA_HOME="C:\Program Files\Java\j2sdk1.5.0\"
    >>>>
    >>>> Note that the " are required because of the space
    >>>> in the name of 'Program Files'.
    >>>
    >>> Yes. The quotes are required *by the DOS shell*.

    >
    > install the jdk on C: drive and it will create c:\j2sdk1.5.0\ directory
    > and you get rid of the potential space problem in the directory name
    > once and for all.
    >

    Or do a 'dir /x' and use the 8 byte dir name. Any Time I have problems
    with spaces in a dir name I use the MS's 8 byte dir name.

    --

    Thanks in Advance...
    IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
    __________________________________________________________________________

    'If there is one, Knowledge is the "Fountain of Youth"'
    -William E. Taylor, Regular Guy (1952-)
    IchBin, Jul 22, 2006
    #5
  6. Andrew Thompson

    Chris Uppal Guest

    IchBin wrote:

    > > install the jdk on C: drive and it will create c:\j2sdk1.5.0\ directory
    > > and you get rid of the potential space problem in the directory name
    > > once and for all.
    > >

    > Or do a 'dir /x' and use the 8 byte dir name. Any Time I have problems
    > with spaces in a dir name I use the MS's 8 byte dir name.


    Or better yet. Track down the software that is unable to deal with spaces in
    filenames and remove it from your system. This applies to both Windows and
    Unix-alikes -- there is /NO/ excuse for a program to be bothered by spaces[*].

    Oh, and software which wants to install to the root of the C: drive is also a
    sign[**] of software that you'd be better off without.

    -- chris

    [*] Newlines in filenames, now, can be a different matter -- but only allowed
    on Unix, IIRC, and not /very/ common, even there.

    [**] Not a /certain/ indicator, but a pretty strong hint...
    Chris Uppal, Jul 23, 2006
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan
    Replies:
    0
    Views:
    5,007
    Stefan
    Nov 5, 2003
  2. Andrew Thompson

    com.sun.tools.javac.Main ..API docs?

    Andrew Thompson, Jan 4, 2004, in forum: Java
    Replies:
    13
    Views:
    4,695
    Andrew Thompson
    Jan 6, 2004
  3. Jesper Sahner
    Replies:
    7
    Views:
    7,895
    Jesper Sahner
    Nov 21, 2004
  4. Miss Michelle. Heigardt
    Replies:
    8
    Views:
    143,144
    abbinv
    Apr 9, 2011
  5. drunken_wizard
    Replies:
    1
    Views:
    11,421
    Tris Orendorff
    Mar 23, 2006
Loading...

Share This Page