Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hiding DOS console w/GUI app.

 
Regus Patoff
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
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.
Thanks,
RP
 
Manfred Leonhardt
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
Runner.bat:
@javaw SomeProgram
where SomeProgram is a compiled class file in the current directory.
Regards,
Manfred.
 
ryan headley
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:
c:\apps\javapps\myprogram
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....
 
Regus Patoff
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys!
Both ways worked great. People like you help make these forums (fora?) excellent resources for all of us.
Reg
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic