wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Console and Swing Application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Console and Swing Application" Watch "Console and Swing Application" New topic
Author

Console and Swing Application

Ikram Soomro
Ranch Hand

Joined: Oct 20, 2001
Posts: 42
HI,
How can I hide the console window in any swing/AWT application if we are running it by clicking on BAT file or are there any other way to run swing/AWT application in which console window does not open?
I just want swing application run without any console just like any other Windows application.
Regards
Ikram Soomro
(SCJP2, SCWCD)
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
use start and javaw together in a .bat file. Like so:
start javaw -jar maccc.jar
or
start javaw -cp .\myjar.jar com.filenabber.MainClass
This causes the console to flash for just a second but disappear afterwards.
brian


My Java Freeware:<br />MACCC - <a href="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
A. Wolf
Ranch Hand

Joined: Sep 28, 2003
Posts: 57
or when creating the jar file, include a folder called META-INF with a file inside it called MANIFEST.MF which contains the line "Main-Class: yourmainclassfile" without the .class extention. when you double click the jar file it will automatically run your program.
Ikram Soomro
Ranch Hand

Joined: Oct 20, 2001
Posts: 42
Thank you very much Brian Pipa and A. Wolf.
Both ideas are great.
Regards,
Ikram Soomro
(SCJP2, SCWCD)
[ April 08, 2004: Message edited by: Ikram Soomro ]
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
Just an FYI - Wolf's idea won't work in Windows when you have .jar files associated with an unzipping program (like Winzip).
brian
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Console and Swing Application
 
Similar Threads
Problem after making an application using JDBC
Hiding DOS console w/GUI app.
my windowclosing doesn't work
Can't see my Panels!!! Aaarrghhhhh....
SWT Resources?