Get current JNLP information

I am launching an application from a jnlp file containing useful information such as provider, description and other field.

What is the most reasonable way to get this data in Runtime in order to create an "About" dialog?

Is there any way to detect that the application was launched without starting Java Web?

Thank you for your help.

Pierre

+5
source share
2 answers

There are various strategies to achieve the desired goal. I will not return to those that have already been mentioned, but instead outlined a few more.


1) Information can be placed in the manifest of the archive. It can be found using the methods of the java.lang.Package class .

String title = pckg.getImplementationTitle();
String vendor = pckg.getImplementationVendor();
String version = pckg.getImplementationVersion();

.

Package[] package = Package.getPackages();

, , .

- Ant - . , ​​ - .


2) JNLP.

<resources>
    .. 
    <property name="jnlp.href" value="${href}" />
    ..
</resources>

BTW - ${href} , href JNLP.

BasicService.getCodeBase() . URL- JNLP, ..

URL urlToJnlp = new URL(
    basicService.getCodeBase(),
    System.getProperty("jnlp.href") );

JNLP XML- J2SE. ( XML- J2SE, , - , JaNeLA.)

, , .

+5

, webstart, jnlp. - :

public boolean launchedByJNLP(){
    try {
        ServiceManager.lookup("javax.jnlp.BasicService");
    } catch (UnavailableServiceException e) {
        return false;
    }

    return true;
}

jnlp " ", , , , , , .

+2

All Articles