This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes passing args into a running java 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 » Java in General
Bookmark "passing args into a running java application" Watch "passing args into a running java application" New topic
Author

passing args into a running java application

Scott Presley
Greenhorn

Joined: Apr 15, 2003
Posts: 25
I have coded a simple multiple document viewing application. Up to this point, I've simply used a file chooser to open the files within my app.

I recently added lines to the registry to allow for an application protocol url, similar to the "mailto: ". So now, I can type in the run window of the windows start menu: "myapp:file1.txt" and windows will launch my app and the file path will be passed through as a command line argument. (background info: i use launch4j to create an exe which in turn calls my jars, launching my app...)

So the next step will be to create an association with a type of file, say *.txt, such that clicking on a txt file will launch my application.

My ultimate goal is to be able to click on a second document in windows somewhere while my app is running and the doc will load in the same instance of my app... does anyone know how this would be accomplished??? I'm assuming that the initial file click, launching the application, will pass the file name in as a command line arg, but once the app is running, how would i get another command line arg into the app??? Is this possible in java??

thanks in advance...

 
Consider Paul's rocket mass heater.
 
subject: passing args into a running java application
 
Similar Threads
Launch App from Windows Explorer and Open File
jar file not working
Launching a file stored in an Oracle db from a web app
Launching a Java app from the desktop.
NoClassDefFoundError when launching as service