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

折月煮酒 提交于 2019-12-22 04:25:11

问题


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?


回答1:


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.




回答2:


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:



来源:https://stackoverflow.com/questions/13555066/where-can-i-find-the-jnlp-api-jar-in-jdk-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!