File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Ant unable to find javac compiler (in Eclipse) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic

Ant unable to find javac compiler (in Eclipse)

Sascha Balkau

Joined: Jan 25, 2006
Posts: 8
Since I've re-installed my Windows system, I got a problem that when I try to compile with Ant in Eclipse, it gives me an error that the Java Compiler cannot be found ...

Unable to find a javac compiler; is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK

However, I've set an env var named JAVA_HOME to my JDK path (D:\Java\jdk1.5.0_06\) and I've also added the bin folder to the path etc. I can use the compiler on the command prompt but Ant keeps telling me this error. What would I have to do to satisfy Ant?
[ April 23, 2006: Message edited by: Sascha Balkau ]
Sascha Balkau

Joined: Jan 25, 2006
Posts: 8
Ah nevermind, I have figured it out by adding the tools.jar from JDK/lib to the classpath for Ant in Eclipse.

However now I got a different problem ...

When I compile and try to run a class that is not in the default package, I get a bunch of errors ...

E:\Works\Eclipse\Java Test\bin\testpack>java Test
Exception in thread "main" java.lang.NoClassDefFoundError: Test (wrong name: testpack/Test)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at Source)
at Source)
at$100(Unknown Source)
at$ Source)
at Method)
at Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)

I'm puzzled with this! What could be wrong now?
Thanks for any hints!
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 15099

See my answer in your other thread.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
marc weber

Joined: Aug 31, 2004
Posts: 11343

Please don't cross-post.

"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
I agree. Here's the link:
subject: Ant unable to find javac compiler (in Eclipse)
jQuery in Action, 3rd edition