Running ant build gives “package org.junit does not exist”

后端 未结 3 2026
感动是毒
感动是毒 2020-11-30 08:47

When I use a Java IDE to build projects (e.g. NetBeans) that have JUnit tests, they compile fine, but when I try to use ant outside of the IDE to run the build script, I get

3条回答
  •  情书的邮戳
    2020-11-30 09:30

    The problem was that in the IDE, it set the classpath correctly to include the .jar for JUnit. Running ant outside the IDE, the classpath was different, thus the error. The fix was to put the JUnit .jar in the folder "C:\Program Files\Java\jre6\lib\ext" so it would always be found outside of any IDE.

提交回复
热议问题