File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes Hiding DOS console w/GUI app. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Hiding DOS console w/GUI app." Watch "Hiding DOS console w/GUI app." New topic

Hiding DOS console w/GUI app.

Regus Patoff

Joined: Oct 30, 2001
Posts: 8
I would like to know how to run a Swing application in Windows (any flavor), without that ugly DOS console window in the background. It would be great if I could also create a shortcut to the application.
Manfred Leonhardt
Ranch Hand

Joined: Jan 09, 2001
Posts: 1492
Hi Regus,
Simply put the following line into any *.bat file and create a desktop shortcut to it and you are all set. The console window will appear and disappear quickly while your program is loading.
@javaw SomeProgram
where SomeProgram is a compiled class file in the current directory.
ryan headley
Ranch Hand

Joined: Jun 28, 2000
Posts: 156
Here's another neat way to do it.
Create a shortuct for it with this as the target:

THEN, in the Start In field add the path to the directory where your classfile is such as:
If that doesn't work for some reason, what I've done is modified the target have the javaw.exe -classpath c:\apps\javapps\myprogram.
Its nifty, no batch files, no dos windows, etc....

Ryan Headley<br /><a href="" target="_blank" rel="nofollow"></a>
Regus Patoff

Joined: Oct 30, 2001
Posts: 8
Thanks guys!
Both ways worked great. People like you help make these forums (fora?) excellent resources for all of us.
I agree. Here's the link:
subject: Hiding DOS console w/GUI app.
It's not a secret anymore!