I created a java project, when I execute my application from eclipse it works without any problems and no exception. I created a jar to execute it works on the computer that I used for the development, I tried on another pc, it only works if I execute java-jar program.jar
in CMD.
I tried to create an application mac (. App) using jarBundler using my jar. but the problem is that when I run the application it works, but it does not stop. In fact one of my button execute a script and a bar execution stops at the end of the execution. mac application that launches the script does not stop, if I try my script in terminal it works with the jar it works. I do not know what is the problem and how to detect it.

- 237
- 2
- 4
- 15
2 Answers
Try to incorporate logging (debug) messages into your code (especially the method that's not finishing execution as expected). Track the states of all objects that are critical for the method execution and compare the results on the different environments.
If you are using multiple Threads, add logging to track their states and make sure they end as expected and there are no deadlocks.
Regarding the differences in the environment (different OSes and console/UI execution), check all java specific environment variables, that would be JAVA_HOME, JAVA_OPTS etc. It's possible (though highly unlikely) that your UI and console user are using different env. variables.

- 30,580
- 6
- 55
- 83
-
I already retrieves the result of execution of my script and I use it as a log but WHILE the script does not finish and does not make its exit code, my log file is empty. I use my code to install apk android phone in when I checked the installation process on the phone, the applications are already installed then execute the script but it does not stop. – user2043602 Mar 13 '13 at 09:52
-
I am confused, you mentioned Mac and console, but now there's an Android Phone? Maybe try to login in the WHILE loop and see when it does hang. If you run this on a phone, you can check DDMS in Eclipse for all the Threads. Otherwise you can take a look at jconsole. – hovanessyan Mar 13 '13 at 10:04
-
i use the application with different OS. i use mac to develop. and the application is used to install application in phone using ADB and usb . and when i run via ecllipse i have no problem – user2043602 Mar 13 '13 at 10:14
If script for stop is not working in mac than you can made some changes in code and write script for close as it can work on both platform.
In case if could not get such code than you write different script for close for mac and other os so first you code for identifying the OS by code than run code by macthing according to OS.
Know OS Like:
public static boolean isWindows() {
String os = System.getProperty("os.name").toLowerCase();
// windows
return (os.indexOf("win") >= 0);
}
public static boolean isMac() {
String os = System.getProperty("os.name").toLowerCase();
// Mac
return (os.indexOf("mac") >= 0);
}
can u clearify about the closing script. this will helpfull..
--Om--

- 311
- 1
- 4
- 8