简体   繁体   English

Eclipse Ant ClassPath问题

[英]Eclipse Ant ClassPath Issue

Using Eclipse Juno on Java 1.8 在Java 1.8上使用Eclipse Juno

    eclipse.buildId=M20130204-1200
    java.version=1.8.0_45
    java.vendor=Oracle Corporation
    BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
    Command-line arguments:  -os win32 -ws win32 -arch x86



    Error
    Tue Jul 21 10:25:12 EDT 2015
    Could not find one or more classes: "org.apache.tools.ant.BuildException". Please check the Ant classpath.

java.lang.NoClassDefFoundError: org/apache/tools/ant/BuildException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.newInstance(Class.java:412)
    at org.eclipse.ant.core.AntRunner.run(AntRunner.java:324)
    at org.eclipse.ant.internal.launching.launchConfigurations.AntLaunchDelegate$1.run(AntLaunchDelegate.java:298)
    at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.BuildException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at org.eclipse.ant.internal.core.AntClassLoader.findClass(AntClassLoader.java:54)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Juno ships with a version of ANT which doesn't work with Java 8, you'll need to manually install a version that works. Juno附带的ANT版本不适用于Java 8,您需要手动安装一个有效的版本。

It's detailed here 这里详细

https://wiki.eclipse.org/Ant/Java8 https://wiki.eclipse.org/Ant/Java8

https://bugs.eclipse.org/bugs/show_bug.cgi?id=395421 https://bugs.eclipse.org/bugs/show_bug.cgi?id=395421

So you need to move to Luna or upgrade Ant manually. 因此,您需要移至Luna或手动升级Ant。

There can be two possibilities: First Your ANT_HOME has the default enties and has the older version of ANT. 有两种可能:首先,您的ANT_HOME具有默认的实体,并且具有较旧的ANT版本。

Go and manually change the entry there and include the required JAR 转到那里手动更改条目,并包含所需的JAR

Preferences > Ant > Runtime > Classpath > Ant Home Entries (Default) 首选项> Ant>运行时>类路径> Ant主页条目(默认)

  1. Check if the ANT jars are present in the LIB folder. 检查ANT jar是否在LIB文件夹中。
  2. Your ANT_HOME has not been configured. 您的ANT_HOME尚未配置。 Go in the above path and configure. 进入上述路径并进行配置。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM