I'm developing an application which has a Launcher class which has the following code to execute the application main class and it has the following code.
public class Launcher {
private static final String jarName = "LDC_MCM.jar";
private static final String mainClassWithPackageName = "com.ars.ldcmcm.Application";
public static void main(String[] args) {
String path = Configuration.getInstance().getAppFolder();
String cmd = "java -XX:+ForceTimeHighResolution -cp "+path+"\\"+jarName+" "+ mainClassWithPackageName;
System.out.println("invoking... \n"+cmd);
try {
Runtime.getRuntime().exec(cmd);
} catch (Exception e) {
e.printStackTrace();
}
}
}
When I saw that my application is not starting I tried running my jar through a batch file with the following commands.
java -jar LDC_MCM.jar
The result of the execution is given below.
F:\SMC>java -Dfile.encoding=UTF-8 -jar LDC_MCM.jar
invoking...
java -XX:+ForceTimeHighResolution -cp F:\SMC\LDC_MCM.jar com.ars.ldcmcm.Application
The execution stays like this the application does not start. Can someone tell why the application stays like this without my application main starting. I have tried roll backing my code to an older version to see if it is anything related to the application code.
Please post a comment if you require any additional details. com.ars.ldcmcm.Application will set up a frame for a swing application.
I tried on more thing in regards this. I tried running the command directly through command prompt and I got an exception as given below.
F:\>java -XX:+ForceTimeHighResolution -cp F:\SMC\LDC_MCM.jar com.ars.ldcmcm.Application
Exception in thread "main" java.lang.NullPointerException
at com.ars.ldcmcm.Application.main(Application.java:283)
Since there is an exception in the application class I tried running the application main via eclipse, the application started as expected.