M
morpheous.sigma
I am new to Java, although I have several years experience with other langs(e.g. C/C++ etc). I am trying to run an example program, which uses Ant for its build. I have struggled to get rid of the ClassNotFoundException being thrown for the last four days and despite trying various solutions postedelsewhere on the Internet, I have been unable to solve the problem.
I wonder if anyone on here can help.
Here is the stack trace, (as well as my attempts to solve the problem):
$ ./init-og-examples-db.sh
### Creating empty database
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
.... 11 more
Could not find the main class: com.opengamma.util.test.DbTool. Program willexit.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
.... 11 more
Could not find the main class: com.opengamma.util.test.DbTool. Program willexit.
### Adding example data
Exception in thread "main" java.lang.NoClassDefFoundError: com/opengamma/examples/tool/ExampleDatabasePopulator
Caused by: java.lang.ClassNotFoundException: com.opengamma.examples.tool.ExampleDatabasePopulator
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.opengamma.examples.tool.ExampleDatabasePopulator. Program will exit.
### Completed
I am runing on Ubuntu 12.0.4 and my environment settings are as follows:
echo $ANT_HOME
/usr/local/apache-ant-1.9.1
echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle/jre
I have set my CLASSPATH as follows:
export CLASSPATH=$CLASSPATH:/usr/local/apache-ant-1.9.1/etc:/usr/local/apache-ant-1.9.1/lib
Can anyone tell me what I am doing wrong?
I wonder if anyone on here can help.
Here is the stack trace, (as well as my attempts to solve the problem):
$ ./init-og-examples-db.sh
### Creating empty database
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
.... 11 more
Could not find the main class: com.opengamma.util.test.DbTool. Program willexit.
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/tools/ant/Task
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Caused by: java.lang.ClassNotFoundException: org.apache.tools.ant.Task
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
.... 11 more
Could not find the main class: com.opengamma.util.test.DbTool. Program willexit.
### Adding example data
Exception in thread "main" java.lang.NoClassDefFoundError: com/opengamma/examples/tool/ExampleDatabasePopulator
Caused by: java.lang.ClassNotFoundException: com.opengamma.examples.tool.ExampleDatabasePopulator
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:294)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: com.opengamma.examples.tool.ExampleDatabasePopulator. Program will exit.
### Completed
I am runing on Ubuntu 12.0.4 and my environment settings are as follows:
echo $ANT_HOME
/usr/local/apache-ant-1.9.1
echo $JAVA_HOME
/usr/lib/jvm/java-7-oracle/jre
I have set my CLASSPATH as follows:
export CLASSPATH=$CLASSPATH:/usr/local/apache-ant-1.9.1/etc:/usr/local/apache-ant-1.9.1/lib
Can anyone tell me what I am doing wrong?