Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Console and Swing Application

 
Ikram Soomro
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
A. Wolf
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 299
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just an FYI - Wolf's idea won't work in Windows when you have .jar files associated with an unzipping program (like Winzip).
brian
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic