Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
    Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Ant unable to find javac compiler (in Eclipse)

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hi,
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;
com.sun.tools.javac.Main 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
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
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 java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown 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!
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
See my answer in your other thread.
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Please don't cross-post.
 
I got this tall by not having enough crisco in my diet as a kid. This ad looks like it had plenty of shortening:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
    Bookmark Topic Watch Topic
  • New Topic