Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Using System.exit(0)  RSS feed

 
Adrian Martin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it normal when using the following:

System.exit(0);

That the following info box appears:



I'm using Dr Java.

Thanks in advance.
error.PNG
[Thumbnail for error.PNG]
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have no idea what DrJava is. What happens when you run it by hand?
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Adrian Martin wrote:Is it normal when using the following:

System.exit(0);


I don't know what context you're seeing that in, so I don't know what's normal there when using System.exit(). With normal command line execution, you wouldn't see anything like that.

What's more normal, however, is to just not use System.exit() at all.
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It certainly looks to me like that dialog box was designed to appear when System.exit was run. After all, that's what it says.

So without any experience with the product in question, but just based on my experience with how applications are typically designed, I would say yes, that dialog box is designed to pop up under the circumstances it says it's popping up for.

And I see it has a checkbox where you can ask not to see it again. I would check that checkbox if I was the one presented with the dialog.
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, before telling the dialog to not bother me any more, I would first experiment to see what happened with System.exit(n) for non-zero values of n.
 
Paul Clapham
Sheriff
Posts: 22476
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch!
 
Adrian Martin
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks everyone. To me it looks like it is doing what it should as the console messages are correct. Just don't like that message and it also clears the interactions dialog/information in DrJava to 'Welcome to DrJava. Working directory is C:\Users\xxxxxx'

I tried to change to System.exit(1) and the same thing happens. I've checked the box so it will not show again. Thanks Paul.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!