[SOLVED] Why does my Java program crash when compiled
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
-
- Level 1
- Posts: 21
- Joined: Wed Apr 29, 2015 4:43 am
[SOLVED] Why does my Java program crash when compiled
Hi, I'm not sure if this is the right forum. I've got a Java program that I'm trying to port from windows to mint cinnamon. It works perfectly when run in netbeans (Linux version 8.0.2) but when I try to run the compiled jar it crashes. Any ideas?
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: Why does my Java program crash when compiled
Run it through a debugger? Fish out the stacktrace and figure out what's wrong with your program?
-
- Level 1
- Posts: 21
- Joined: Wed Apr 29, 2015 4:43 am
Re: Why does my Java program crash when compiled
Probably some more info might be helpful. The program starts properly displays input boxes and accepts input but crashes as soon as it needs to access a file. But it only does this after I build the jar file and try to run it then. Within netbeans it runs perfectly with no errors. At the risk of sounding like an idiot I've only ever used netbeans and I don't know what a stacktrace is.
Re: Why does my Java program crash when compiled
Start your Java program from the terminal. JVM should output a stacktrace there if it crashes, telling you where exactly it crashes. Usually it is sequence list of functions or methods calling each other, allowing you to figure out in which function or method the program crashed and perhaps some info on why. A debugger will do more.
Sounding like another idiot, I don't know netbeans Perhaps it sets up your runtime environment differently.
Sounding like another idiot, I don't know netbeans Perhaps it sets up your runtime environment differently.
-
- Level 1
- Posts: 21
- Joined: Wed Apr 29, 2015 4:43 am
Re: Why does my Java program crash when compiled
Managed to get it to run by using java -jar <program name> . Still won't run by double clicking the icon though. But at least I can use it now. One step closer to ditching windows.