Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running java files without ugly command prompt box in the background

Tags:

java

cmd

javac

I made a java program with a GUI using eclipse so whenever I want to run it I run it there, but my friend wants to run it on his computer so I made a class-file using javac in command prompt and also made a batch-file to run the program. The problem is that every time ha runs it this command window is still in the background. So what I want is to make that box disappear, is it any way to do that?

Appreciate all answers :)

like image 890
Sindre Brattegard Avatar asked May 12 '13 16:05

Sindre Brattegard


1 Answers

Launch it with javaw instead of java. The Description for java mentions:

The javaw command is identical to java, except that with javaw there is no associated console window. Use javaw when you don't want a command prompt window to appear. The javaw launcher will, however, display a dialog box with error information if a launch fails for some reason.

like image 197
Andrew Thompson Avatar answered Nov 14 '22 22:11

Andrew Thompson