aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes To run a swing application in window system Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of JavaScript Promises Essentials this week in the JavaScript forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "To run a swing application in window system" Watch "To run a swing application in window system" New topic
Author

To run a swing application in window system

glen li
Greenhorn

Joined: Aug 24, 2004
Posts: 19
How can I put a shortcut on desktop in order to run my application(6 classes)when I click it?
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
Hi Glen,

Two ways I can think to do this.

1) create an executable jar file of the application and then put that on the desktop

2) create a batch file (assuming windows) with the relevant java command to run your application in it and put that on the desktop


SCJP 1.4, www.gsi3d.org.uk
omar bili
Ranch Hand

Joined: Aug 13, 2004
Posts: 177
hi guys
the batch file wont block on the
first program and wait for it to exit !!?
i think it does.
Ben Wood
Ranch Hand

Joined: Aug 14, 2001
Posts: 342
That's no problem though. I'm assume the 6 classes mentioned form 1 application, not 6 separate ones? Just call java on the main class in the batch file. Side-effect is that you are left with a command window open while the program is running.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
right click the class file(the one with main()) - select sendto/desktop/create shortcut
right click the shortcut - select properties
look for 'Target'
eg in Target it may be
"C:\Documents and Settings\Java\Testing.class"

change this to
javaw -classpath "C:\Documents and Settings\Java" Testing

(note the 'space' before and after -classpath and before Testing)
(windows will add the extra stuff it needs)
glen li
Greenhorn

Joined: Aug 24, 2004
Posts: 19
Thanks guys, big help!

glen
glen li
Greenhorn

Joined: Aug 24, 2004
Posts: 19
Thanks guys, big help!

glen
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: To run a swing application in window system