redbaron11
Programmer
I have a simple HelloWorld application, which i want to start with ant. Here the ant build.xml:
<project name="test" default ="run-helloworld">
<target name="run-helloworld">
<java classname="build/HelloWorld" fork="true" />
</target>
</project>
HelloWorld.class is saved in the directory build. if i run ant, i get exceptions, listed below:
Buildfile: build.xml
run-helloworld:
[java] java.lang.NoClassDefFoundError: build/HelloWorld (wrong name: HelloW
orld)
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:124)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 0 seconds
But, if i save my HelloWorld.class in the root directory and change the ant build.xml, everything is fine:
<project name="test" default ="run-helloworld">
<target name="run-helloworld">
<java classname="HelloWorld" fork="true" />
</target>
</project>
if i run it:
Buildfile: build.xml
run-helloworld:
[java] Hello World
BUILD SUCCESSFUL
Total time: 0 seconds
How i have to implement the path to my directories, that it will work? Have you some hints for me?
Thanks and greetings,
redbaron
<project name="test" default ="run-helloworld">
<target name="run-helloworld">
<java classname="build/HelloWorld" fork="true" />
</target>
</project>
HelloWorld.class is saved in the directory build. if i run ant, i get exceptions, listed below:
Buildfile: build.xml
run-helloworld:
[java] java.lang.NoClassDefFoundError: build/HelloWorld (wrong name: HelloW
orld)
[java] at java.lang.ClassLoader.defineClass1(Native Method)
[java] at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
[java] at java.security.SecureClassLoader.defineClass(SecureClassLoader
.java:124)
[java] at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
[java] at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
[java] Exception in thread "main"
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 0 seconds
But, if i save my HelloWorld.class in the root directory and change the ant build.xml, everything is fine:
<project name="test" default ="run-helloworld">
<target name="run-helloworld">
<java classname="HelloWorld" fork="true" />
</target>
</project>
if i run it:
Buildfile: build.xml
run-helloworld:
[java] Hello World
BUILD SUCCESSFUL
Total time: 0 seconds
How i have to implement the path to my directories, that it will work? Have you some hints for me?
Thanks and greetings,
redbaron