Hi Everyone,
I am writing a model checker and need to store and restore state of programs. After googling, I found Apache Javaflow appears to be a neat tool to do it. However, I got problem running it. Can someone kindly help?
I download the commons-javaflow-2006.jar and asm-3.3.jar and try to
test it with the example on Apache:
http://commons.apache.org/sandbox/javaflow/tutorial.html
This is the code:
I write build.xml like this:
Below is the output:
Buildfile: build.xml
clean:
build:
[javac] Compiling 1 source file to /home/lihao/Desktop/JavaflowTest/class
[javaflow] Rewriting /home/lihao/Desktop/JavaflowTest/class/MyRunnable.class
run:
[
java] Exception in
thread "main" java.lang.NoClassDefFoundError: MyRunnable
[java] Caused by: java.lang.ClassNotFoundException: MyRunnable
[java] at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
[java] at java.security.AccessController.doPrivileged(Native Method)
[java] at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
[java] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
[java] at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
[java] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
[java] Could not find the main class: MyRunnable. Program will exit.
[java] Java Result: 1
BUILD SUCCESSFUL
Total time: 1 second
And the compilation seems fine. But when running, it turns out "Could not find the main class".
We I run the instrumented Myrunnable.class from commandline, it report error like this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/javaflow/bytecode/Continuable
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)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.javaflow.bytecode.Continuable
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)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
... 12 more
Could not find the main class: MyRunnable. Program will exit.
I don't understand why. I have included every possible lib in my classpath. Please help!
Thanks.