0

Is there any normal reason that a GUI would work when launched by running code from, say, Netbeans, but have trouble when launched from a .jar? If I launch my program from Netbeans via Run, it works fine. All buttons work, their functionality works and all is well. I do a clean and build, and when i then run the .jar, one of the buttons stops working, and all the functionality put into buttons and fields stops working.

In case there's no easy answer to this problem, is there a way to see an error log from a jar file?

1
  • As to logs, configure your logger system so that it spout everything to stdout. BTW, which OS is that? If Unix-like, is the DISPLAY environment variable set? Commented Dec 18, 2011 at 17:36

5 Answers 5

3

Open a command prompt, and use

java -jar youJarFile.jar

Unhandled Exceptions will display in the CLI/terminal.

Sign up to request clarification or add additional context in comments.

Comments

1

you should to set--->

1) right mouse click on Project, last option is Properties

2) in the Run select from drop-down proper Main-class

3) maybe this thread will help you

Comments

1

In the settings of your IDE, check which classpath is used, which JDK, which settings.

Run the jar from the commandline to see errormessages.

your jar may also lack a Manifest file which could make your jar clickable to start the application.

Comments

0

If you have written all code yourself, you can make use of assertions or the Logger API.

http://docs.oracle.com/javase/1.4.2/docs/api/java/util/logging/Logger.html

http://docs.oracle.com/javase/1.4.2/docs/guide/lang/assert.html

this shoul aid in getting to the root cause...

Comments

0

Look into the PATH variable of your system and see whether the path to your JRE is included, and if it's the same as the one that your IDE is using.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.