Executable JAR Files, and execution in a linux terminal
807588Feb 18 2009 — edited Feb 19 2009Hi,
I have a (hopefully) small problem.
I developed a small application using Java, SWT and a Derby Database. The application is supposed to be a Desktop application to administer some kind of Tournament. I'm developing on Linux with Eclipse.
If I run the app in Eclipse, everything runs well. But if I create an Executable JAR File I'm running into problems:
If I'm executing the file in the terminal with the command "./myjarfile.jar" everything runs fine, like in Eclipse. But If I execute the file with the gij compiler using the command "gij -jar myjarfile.jar", I see a different behavior: a) It seems to be a bit slower to load b) after some seconds it aborts the application without explication. The output at the console simply says "Aborted".
Now can someone please explain me why the behavior of my app changes from one command to the other? Up to now I thought that an executable JAR file uses bytecode which has to be interpreted anyways. So I thought if I execute the program directly with "./myjarfile.jar" it just links the file to the Java interpreter. Obviously I was wrong.
I have two Questions:
1. What happens with the command "./myjarfile.jar" and why does it differ from "gij -jar myjarfile.jar"?
2. I noticed that on most linux computers "./myjarfile.jar" does not work at all, even though the Java Runtime Environment is installed. Is this because they don't have the JDK installed?
Thanks!!
Till