Closed tsdh closed 9 years ago
The *.class
files are there, too, and I can run it with java example04.ChildClass1
just fine.
Well that is a good question.
We call:
Runtime runtime = Runtime.getRuntime();
String java = System.getProperty("java.home")+"/bin/java";
String main_class = "example04.ChildClass1"
Process p = runtime.exec("\""+java+"\" -cp "+program_folder+"/src"+" "+main_class);
All path separators are of course retrieved via system properties in the real ARTE code.
At the moment I do not see what has changed in this case.
java -cp paper-example04/src example04.ChildClass1
works, too.
Hm, the message Error: Could not find or load main class example04.ChildClass1
is already what the process emits on its error stream, right? Maybe some timing problem, e.g., you compile the classes also using a process and don't wait for it to be finished (p.waitFor()
) before starting the program?
Ok,
we definitely wait for the compilation task to finish.
Yes this message is the error stream of the java process.
Therefore has to be found. The name of the main class seems to be correct, too.
So only the given class path is left as source of the failing execution. As we use the same path for compilation and have an existence check only the src
folder is left as a source of the error.
As only this singe program fails I am sure this folder is existent, too.
Do you maybe have created the new java files outside of the src
folder?
Have you tried to manually call the executen with the -cp classpath
argument or was your current directory always the program location?
$JAVA_HOME/bin/java -cp /tmp/tmp_ttc/paper-example04/src ecample04.ChildClass1
If the JAVA_HOME path variable is not set on your system this is not the problem as ARTE doesn't access it.
I'll debug a bit more tomorrow. Today I've had no time...
No problem, I just wanted to keep you up to date
Ah, I found the problem! The new class is foo.Foo
but my transformation puts it in a file example04/Foo.java
. That won't compile of course.
I really wonder why it works for you... But at least ARTE should tell us if the sources don't compile. In the current case, javac
emits
paper-example04/src/example04/Foo.java:4: error: duplicate class: foo.Foo
class Foo {
^
paper-example04/src/example04/ChildClass1.java:4: error: cannot access Foo
public class ChildClass1 extends Foo {
^
bad source file: paper-example04/src/example04/Foo.java
file does not contain class example04.Foo
Please remove or make sure it appears in the correct subdirectory of the sourcepath.
That's a lot more helpful than just java complaining that it cannot find the main class.
I get this output:
ChildClass1
after the transformation looks like this:Before it was
So why is it not runnable anymore? Nothing has changed except that it is now a
Foo
subclass and the comment inmain()
is gone because JaMoPP doesn't save comments.