java 导入“javax.jnlp”无法解析

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10870810/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 02:54:47  来源:igfitidea点击:

The import "javax.jnlp" cannot be resolved

javaimportjnlpjava-web-start

提问by MadeOfAir

I am learning Java and trying to run some examples using Java web start.

我正在学习 Java 并尝试使用 Java web start 运行一些示例。

However, I cannot seem to find that package javax.jnlp.

但是,我似乎找不到那个包javax.jnlp

This same error is haunting me on both windows and linux.I've installed oracle jdk 7 on windows.OpenJDK 1.6 is the version installed on linux.

同样的错误在 windows 和 linux 上都困扰着我。我在 windows 上安装了 oracle jdk 7。OpenJDK 1.6 是安装在 linux 上的版本。

Searching the internet for the package with no luck.It is no longer available on oracle's website because they insist that the package is a part of the jdk.

在互联网上搜索包没有运气。它不再在 oracle 的网站上可用,因为他们坚持认为该包是 jdk 的一部分。

I've searched the installation directories for it.some claim it is in the jnlp.jarfile, others claim in javaws.jarfile...neither files are part of my installation.

我已经在安装目录中搜索了它。有些人声称它在jnlp.jar文件中,其他人则声称在javaws.jar文件中……这两个文件都不是我的安装的一部分。

采纳答案by PrimosK

From the Oracle page:

从 Oracle 页面:

The jardiff tool, jnlp-servlet.jar file, and jnlp.jar file can be found in the samples directory of the JDK.

jardiff 工具、jnlp-servlet.jar 文件和jnlp.jar 文件可以在JDK 的samples 目录中找到。

On my comp it is in:

在我的比赛中,它位于:

... /jdk1.6.0_23/sample/jnlp/servlet/jnlp.jar

... /jdk1.6.0_23/sample/jnlp/servlet/jnlp.jar



For Java 7 you have to download Demos and Samplesseparately:

对于 Java 7,您必须分别下载Demos 和 Samples

Windows x86 (32-bit) 15.62 MB jdk-7u4-windows-i586-demos.zip

Windows x86(32 位)15.62 MB jdk-7u4-windows-i586-demos.zip

Windows x64 (64-bit) 15.69 MB jdk-7u4-windows-x64-demos.zip

Windows x64(64 位)15.69 MB jdk-7u4-windows-x64-demos.zip

You will find jnlp.jar inside: jdk1.7.0_04\sample\jnlp\servlet\jnlp.jar

你会在里面找到 jnlp.jar: jdk1.7.0_04\sample\jnlp\servlet\jnlp.jar

回答by Rikki

Can be found in jre/lib/javaws.jarin 1.7 and 1.8, as per: https://stackoverflow.com/a/13555413/829305

可以jre/lib/javaws.jar在 1.7 和 1.8 中找到,根据:https: //stackoverflow.com/a/13555413/829305

The jre/directory can be found inside the jdk/directory if you've only got the JDK installed.

如果您只安装了 JDK,则jre/可以在该目录中找到该jdk/目录。

回答by Mikhaylo

You should add the path to javaws.jar file in your classpath. For example: "javac -classpath .:/path/to/javaws.jar webstart/*.java"

您应该在类路径中添加 javaws.jar 文件的路径。例如:“javac -classpath .:/path/to/javaws.jar webstart/*.java”