简体   繁体   中英

Java application stops without any error message or exception

I am developing a Java application that runs fine on several hundred machines, both Windows and Linux (using latest Oracle JRE). However, on one Windows 7 64-bit machine the application won't run.

Interesting fact: If started from command line via java -jar MyApp.jar then the application "just fails" and returns to the shell, without any message at all.

In order to find the problem I wrapped the whole content within main() like this:

public static void main(String [] args)
{
    try
    {
        // Init. Swing GUI, run application ...
    }
    catch(Throwable t)
    {
        t.printStackTrace();
        System.exit(1);
    }
}

Unfortunately, even with this try-catch block I still don't get any message on command line.

Can you recommend any other ways for me to find out where the problem could be?

if possible enable debug method on that machine. otherwise. you may write some debug lines to a log file external to the jar. so that, you will know whether JVM calls the the main method or not. also try to check java version on that machine if your jar is depending on the specific jre on the windows 7 64 bit machine.

It's possible that your application is running without an exception. However, it's simply not rendering as expected.

One simple diagnostic should provide some more info. Add a "-verbose" switch to your command line. That will print all the classes loaded during your application invocation.

$> java -verbose -jar MyApp.jar

Should show some additional info. Note! make sure you add -verbose as the first argument like I demoed above.

Hopefully that get's you started.

Also, you can add a System.out.println("SOME MESSAGE") as the first line in your try block. That might help also.

仅作记录:我们需要安装64位版本的JRE,现在该应用程序又像魅力一样工作了:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM