This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

To run a swing application in window system  RSS feed

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I put a shortcut on desktop in order to run my application(6 classes)when I click it?
 
Ranch Hand
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 177
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 342
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, big help!

glen
 
glen li
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks guys, big help!

glen
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!