Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find the jnlp api jar in jdk 7? [duplicate]

Possible Duplicate:
Can’t find jnlp.jar in JDK 1.7

For jdk 1.6, it can be found here (according to Where can i download JNLP.jar):

${java.home}/sample/jnlp/servlet/jnlp.jar

However, I don't see this directory in my jdk 7 home.

Where did it go?

like image 918
Reto Höhener Avatar asked Nov 25 '12 20:11

Reto Höhener


2 Answers

In java 7 javax.jnlp.* packages are part of the the jre and can be found in the javaws.jar on the following path

C:\Program Files\Java\jre7\lib\javaws.jar

If using maven:

<dependency>
    <groupId>javax.jnlp</groupId>
    <artifactId>jnlp-api</artifactId>
    <version>7.0</version>
    <scope>system</scope>
    <systemPath>${java.home}/lib/javaws.jar</systemPath>
</dependency>

If you are after jnlp-download-servlet and jnlp-servlet.jar

The samples earlier provided as part of the jdk has to be downloaded separetlely from oracle now: Scroll down to "demos and samples"

Someone has been nice and put a copy in maven repos (guess we cant be sure it is not lagging behind if oracle updates theirs..):

<dependency>
    <groupId>org.codehaus.mojo.webstart</groupId>
    <artifactId>webstart-jnlp-servlet</artifactId>
    <version>1.0-6.0.02_ea_b02.2</version>
</dependency>

Edit: As Zalumon states in his answer the javax.jnlp.* api can also be found in the samples-package. Downloading this and adding jnlp.jar to the classpath from there should be recomended as oposed to adding javaws.jar as i suggested above.

like image 121
Aksel Willgert Avatar answered Oct 15 '22 10:10

Aksel Willgert


Thanks for all your tips - I wasn't aware that there is a separate download for the samples.

So here's what I ended up doing (note that I have my own remote repository, so this might not apply to you):

I downloaded the jdk7 samples from Oracle's website. Inside I found a jnlp.jar, which contains just the jnlp API:

sample\jnlp\servlet\jnlp.jar

This I deployed to my private remote repository (artifactory) as jnlp-api-1.7.jar and then configured the pom.xml like so ('provided' scope because at runtime these classes are provided by javaws.jar, as pointed out by Aksel Willgert):

<dependency>
  <groupId>javax.jnlp</groupId>
  <artifactId>jnlp-api</artifactId>
  <version>1.7</version>
  <scope>provided</scope>
</dependency>

And for completeness, a screenshot of the deployment to artifactory:

like image 6
Reto Höhener Avatar answered Oct 15 '22 11:10

Reto Höhener