1

I have not been able to find a clear answer on Google. What happens if an unhandled exception is thrown during runtime by an executable jar file? Will it open CMD? Also, would (exception_name).printStackTrace() do the same?

I would test these things, but I do not know how to create an executable .jar. So a short explanation on how to create one in Eclipse would also be appreciated. (Easy to lookup and found)

Josiah Savoie
  • 135
  • 12

1 Answers1

2

What happened when you put together an example jar and tried yourself?

They'll go to the standard error output. If you don't set it programatically, then it depends on how you're running the jar.

  • From an IDE it goes to your IDE's output.
  • If you run the jar from the command line, then that command line is your standard out.
  • If you run the jar by double-clicking it, then the standard output isn't shown anywhere. It won't automatically open a command prompt, which you would have seen if you just created an example program.

See also, possible duplicate: Java jar output. where it goes?

Edit: Another possible duplicate: Where is System.err on Windows?

Community
  • 1
  • 1
Kevin Workman
  • 41,537
  • 9
  • 68
  • 107