Java Web Start getDocumentBase

I am experimenting with Java Web Start.

I just wrote a basic JAppletone that has a method in a class Appletcalled getDocumentBase(). This returns full URLto the location where it works Applet(under Tomcat), i.e. http: // myserver: 8080 / myapp / whateverapplet.jar .

However, I am looking for something similar with a web launch application. I need to know where he works. Is there anything that can give me this information?

EDIT

In terms of where it works, I mean, if I run web start from the JNLP file that I want:

http: // myserver: 8080 / myapp

If I run the JAR from a folder on the network, I want:

\\ server \ MyApp

Or, if I run the JAR from a folder on my machine, I want:

D: \ myapp

Edit end

+5
2

, ? , :

final BasicService bs = (BasicService) ServiceManager.lookup(
    "javax.jnlp.BasicService");
final URL codeBase = bs.getCodeBase();

, JNLP API ( BasicService).

+5

, javax.jnlp.BasicService.getCodeBase - , .

. JNLP, JAR, .

:
    URL

(BasicService " AppletContext", getDocumentBase(), .)

+3

All Articles