java 我在哪里可以找到 jdk 7 中的 jnlp api jar?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13555066/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Where can I find the jnlp api jar in jdk 7?
提问by Reto H?hener
Possible Duplicate:
Can't find jnlp.jar in JDK 1.7
可能的重复:
在 JDK 1.7 中找不到 jnlp.jar
For jdk 1.6, it can be found here (according to Where can i download JNLP.jar):
对于 jdk 1.6,可以在这里找到(根据我在哪里可以下载 JNLP.jar):
${java.home}/sample/jnlp/servlet/jnlp.jar
However, I don't see this directory in my jdk 7 home.
但是,我在我的 jdk 7 home 中没有看到这个目录。
Where did it go?
它去了哪里?
采纳答案by Reto H?hener
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:
我从 Oracle 的网站下载了 jdk7 示例。在里面我找到了一个 jnlp.jar,它只包含 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):
我将其作为 jnlp-api-1.7.jar 部署到我的私有远程存储库(artifactory),然后像这样配置 pom.xml(“提供”范围,因为在运行时这些类由 javaws.jar 提供,正如 Aksel 指出的那样威尔格特):
<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:
为了完整起见,还有一个部署到 artifactory 的屏幕截图:
回答by Aksel Willgert
In java 7 javax.jnlp.*packages are part of the the jre and can be found in the javaws.jar
on the following path
在 java 7 javax.jnlp.*包是 jre 的一部分,可以javaws.jar
在以下路径中找到
C:\Program Files\Java\jre7\lib\javaws.jar
If using maven:
如果使用 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
如果你在jnlp-download-servlet 和 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"
之前作为 jdk 一部分提供的示例现在必须从 oracle 单独下载: 向下滚动到“演示和示例”
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..):
有人很好,并在 maven repos 中放了一份副本(我猜我们不能确定如果 oracle 更新他们的,它不会落后..):
<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.
编辑:正如 Zalumon 在他的回答中所说,javax.jnlp.* api 也可以在示例包中找到。应该推荐下载此文件并将 jnlp.jar 添加到类路径中,因为我建议不要像上面建议的那样添加 javaws.jar。