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

2

9

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?

Pitiful answered 25/11, 2012 at 20:17 Comment(0)
P
6

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:

Pitiful answered 26/11, 2012 at 10:26 Comment(0)
L
11

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.

Longevity answered 25/11, 2012 at 20:55 Comment(4)
If it is a a part of the JRE then why do special tricks to make it a maven dependency?Emee
Good question, Even if it's part of the jre, i had to add it to the project classpath in eclipse to be able to code towards javax.jnlp.* packages API. When app is launched as javaws, the the jre/system provided them tho.Longevity
Sounds like it is because the "javaws" command is part of the JRE, but that the jnlp classes is not on the default classpath. Perhaps just an API maven artifact then?Emee
I'm comparing the code in org.codehaus.mojo.webstart:webstart-jnlp-servlet:1.0-6.0.02_ea_b02.2 and org.codehaus.mojo.webstart-jnlp-servlet:webstart-jnlp-servlet:1.0-beta-4 and it looks like the latter of the two is the one to go with. It seems to be getting maintained as I see a couple of bug fixes in it at a quick glance.Cogitate
P
6

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:

Pitiful answered 26/11, 2012 at 10:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.