Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Info - com.sun.tools.javac.Main is not on the classpath

Reply
Thread Tools

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

 
 
Andrew Thompson
Guest
Posts: n/a
 
      07-22-2006
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.

 
Reply With Quote
 
 
 
 
lordy
Guest
Posts: n/a
 
      07-22-2006
On 2006-07-22, Andrew Thompson <(E-Mail Removed)> 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 ****-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
 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      07-22-2006
lordy wrote:
> On 2006-07-22, Andrew Thompson <(E-Mail Removed)> 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 ****-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.

 
Reply With Quote
 
ge0rge
Guest
Posts: n/a
 
      07-22-2006
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
 
Reply With Quote
 
IchBin
Guest
Posts: n/a
 
      07-22-2006
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-)
 
Reply With Quote
 
Chris Uppal
Guest
Posts: n/a
 
      07-23-2006
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...




 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.classpath file instead of the CLASSPATH Environment variable. dontspammenow@yahoo.com Java 2 03-02-2008 08:19 AM
problem compiling project, classpath in xml ".classpath" "<classpathentry...>" jameshanley39@yahoo.co.uk Java 2 03-02-2007 12:37 PM
How to get the full classpath info bill_j_chen@yahoo.com Java 3 11-18-2006 02:19 AM
while using javac -classpath some.jar some.java (Where does classpath get stored?) Gabe Java 3 08-27-2004 07:02 PM
CLASSPATH, -cp and -classpath misunderstanding? Flip Java 3 02-09-2004 10:09 PM



Advertisments