Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

problem building with ant - no classdef found for javac.main

 
Ed Mahoney
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm running j2sdk 1.4.1_01 (international version) and when I try to compile a java program with ant, I get the following message:
[javac] BUILD FAILED: file:C:/.../WEB-INF/src/build.xml:57: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK
Java_Home does seem to be pointing to the sdk. I found some messages on the net relating to the latest sdk having problems with javac. Should I roll back to a previous version of the sdk or could this be a problem with just the international version?
Thanks in advance,
Ed
 
SenthilKumar Natarajan
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ed,
You just try the previous version. I am using jdk1.3.1_03 with ANT its working properly.
Senthil
 
M.K.A. Monster
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is a new update available now: JavaTM 2 SDK, Standard Edition Updates 1.4.1_02
http://java.sun.com/j2se/1.4.1/index.html
Regards,
Mark Monster
 
Ed Mahoney
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
installing the new Jsdk did it. No more problems. Thanks.
 
Thomas Smets
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thought the matter seems to be closed...

Did you add the ${JAVA_HOME}/bin to your PATH variable ?
Thomas,
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I have the same problem, JAVA_HOME is set to C:\j2sdk1.4.2_05 and PATH has C:\j2sdk1.4.2_05\bin in it, but I get the same error message, any ideas?

Karianna
 
mike rascher
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I had the same problem and reverting to an older jdk was not an option. Strangely, the problem was solved by changing the ant build.xml from this:


to this:

I haven't had time to play with the different flags to determine which one is the culprit.
 
Stephanie Nguyen
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this is somewhat of an old thread, but I was having the same problem and adding fork="yes" to the javac tag in ant solved it for me.
 
Jim Olsen
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was also having this problem (on Windows). I think maybe I didn't set my JAVA_HOME variable until after Tomcat was installed so the installer set some Java stuff incorrectly.

In any case, copying %JAVA_HOME%\lib\tools.jar to %TOMCAT_HOME%\common\lib fixed the problem for me. I found this solution in http://localhost:8080/tomcat-docs/setup.html.
 
John Croucher
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jim,
That solved the problem for me too. I also did not have the JAVA_HOME variable set prior to installing Tomcat 5.0. I am using j2sdk1.4.2_08 on Win XP SP2.
 
Al Krinker
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you Mike!

I added fork="yes" and it worked!

p.s. If anyone needs experienced jdk install/uninstaller please let me know
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic