File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JNLP and Web Start and the fly likes Is my app launched via webstart Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Reply Bookmark "Is my app launched via webstart" Watch "Is my app launched via webstart" New topic
Author

Is my app launched via webstart

Ronnie Phelps
Ranch Hand

Joined: Mar 12, 2001
Posts: 329
I have an application that can be launched via webstart or outside of webstart. I know there is a way of checking whether the current application was launched via webstart or outside of webstart but I don't remember what the code looked like or where to find it. If anyone has an idea, let me knwo.
Sailaja Akkineni
Greenhorn

Joined: Sep 06, 2003
Posts: 9
Hi,
I hope this would help you.Check out this URL http://java.sun.com/products/javawebstart/faq.html#5
Sailaja
Smita Mangal
Greenhorn

Joined: Oct 16, 2003
Posts: 1
Hi,
In the JNLP file u can provide the commandline arguments. And in the main method check the parameter, this way u can confirm the source of application whether via Java Web Start or not.
The arguments can be passed through JNLP file like:
<application-desc main-class="venus.Tool" />
<application-desc main-class="com.abc.MyClass">
<argument>-jconsole disable</argument>
<argument>show</argument>
</application-desc>
Hope this helps
Thanks
Smita
Ian Hand
Greenhorn

Joined: Oct 16, 2003
Posts: 3
I used a system property for this, this line in the resources section of my .jnlp:
<property name="webstart" value="true"/>
Then System.getProperty("webstart") will return the String "true" if you are running from web start, null otherwise. So your application can do:
if(System.getProperty("webstart") != null)
{
// web start specific behaviour
}
(you might want to check that the right value is returned, just in case someone else has set the system property.)
Dunno how robust this is, but hope it helps
[ October 16, 2003: Message edited by: Random Username ]
 
 
subject: Is my app launched via webstart
 
Threads others viewed
standard output screen
ProJavaFX examples
Passing Command line args
New SCEA Mock Exam Available
Jprobe and Java Webstart applications
MyEclipse, The Clear Choice

cast iron skillet 49er

more from paul wheaton's glorious empire of web junk: cast iron skillet diatomaceous earth rocket mass heater sepp holzer raised garden beds raising chickens lawn care CFL flea control missoula heat permaculture