0
votes

I am trying to compile simple Hello World program mentioned in the website.My Ant is not able to compile the code , it wants version 1.8.0 or higher version. I have downloaded almost all tye of ants from Apache website

  1. all the binaries are 1.7 version
  2. source code I am not able to compile getting following error

    ... Bootstrapping Ant Distribution ... Compiling Ant Classes Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/ tools/javac/Main Caused by: java.lang.ClassNotFoundException: com.sun.tools.javac.Main at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java at java.lang.ClassLoader.loadClass(ClassLoader.java:266) at java.lang.ClassLoader.loadClassInternal(ClassLoader.jav Could not find the main class: com.sun.tools.javac.Main. Program will exit. ... Failed compiling Ant classes ! Bootstrap FAILED

for these errors , i have tried defining class path.

Regards Sidharth Rai

2

2 Answers

0
votes

all the binaries are 1.7 version

No, they are not. If you visit the Apache Ant Web site's download page, you can download Ant 1.8.2 from any of the mirrors.

0
votes

I think your problem is that you have not set the JAVA_HOME variable to point at a Java JDK. See the ANT installation instructions:

http://ant.apache.org/manual/install.html#advanced

Rather confusingly Java comes in two flavours, JRE and the JDK. It's the latter that contains tools like javac for compiling java code.