jdk1.6中使用Endorsed目录的确切方法是什么

发布于 2024-09-01 20:37:21 字数 1215 浏览 5 评论 0原文

我想将我的 jaxws 升级到 2.2(jdk1.6 与 jaxws 2.1 捆绑在一起)。我的jdk是(我没有安装公共jre):

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode)

jaxws自己的文档中他们解释了如何做到这一点:

解决此问题的一种方法是将 jaxws-api.jar 和 jaxb-api.jar 复制到 JRE 认可的目录中,即 $JAVA_HOME/lib/endorsed (或 $JDK_HOME/jre/lib /endorsed)

但我不确定这对我的安装有任何影响。对于初学者来说,我只定义了 %JAVA_HOME%。并且文件夹 $JAVA_HOME/lib/endorsed 不存在,因此我创建并复制了这两个 jar。但是如果我这样做(wsgen是jaxws的一个工具)

wsgen -version

我仍然得到:

JAX-WS RI 2.1.6 in JDK 6

我还尝试创建文件夹JAVA_HOME\jre\lib\endorsed(请注意,在文档中他们说JDK_HOME,但因为我只有JAVA_HOME我用的是这个路径)。仍然相同的 wsgen 输出。

我的问题是:

  1. 文档页面中的 JAVA_HOME 和 JDK_HOME 有什么区别?有什么重要的或者只是两种引用 JAVA_HOME 的方法?
  2. 'wsgen -version' 是检查所使用的 jaxws 版本的有效方法,还是总是调用原始 jdk 中的 exe,但这并不意味着将使用认可的 jar?
  3. 有人知道在 jdk.16 中安装 jaxws2.2 的非常详细的步骤吗?

我发现这篇文章对我所看到的内容有一些提示

I want to upgrade my jaxws to 2.2 (jdk1.6 comes bundled with jaxws 2.1). My jdk is (I did not install public jre):

java version "1.6.0_20"
Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode)

In jaxws' own doc they explain how to do it:

One way to fix this is to copy jaxws-api.jar and jaxb-api.jar into JRE endorsed directory, which is $JAVA_HOME/lib/endorsed (or $JDK_HOME/jre/lib/endorsed)

But I am not sure this is having any effect in my installation. For starters I have only defined %JAVA_HOME%. And folder $JAVA_HOME/lib/endorsed is inexistant, so I created and copied the two jars. But if I do (wsgen is a tool from jaxws)

wsgen -version

I still get:

JAX-WS RI 2.1.6 in JDK 6

I also tried creating folder JAVA_HOME\jre\lib\endorsed (notice that in the doc they say JDK_HOME, but as I only have JAVA_HOME I used this path). Still same wsgen output.

My questions are:

  1. What is the difference between JAVA_HOME and JDK_HOME in the doc page? anything significant or just two ways to refer to JAVA_HOME ?
  2. Is 'wsgen -version' a valid way to check jaxws version that is used or this always calls the exe in the original jdk, but it does not mean endorsed jars will be used?
  3. Anyone knows very detailed steps to install jaxws2.2 in a jdk.16?

I found this post that has some hints about what I am seeing I think

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

ζ澈沫 2024-09-08 20:37:21

您应该检查系统属性java.endorsed.dirs,例如通过调用System.getProperty("java.endorsed.dirs")。在 Windows 计算机上,这通常类似于 C:\Program Files\Java\jdk1.6.0_16\jre\lib\endorsed。将您要认可的 jar 文件放在这里。如果该目录不存在,则创建它。

另一种选择是将 jar 放在您自己喜欢的目录中,但通过添加命令行开关 -Djava.endorsed.dirs=<您认可的 jar 目录> 来覆盖系统属性。

You should check you system property java.endorsed.dirs, e.g. by calling System.getProperty("java.endorsed.dirs"). On a Windows machine, this is usually something like C:\Program Files\Java\jdk1.6.0_16\jre\lib\endorsed. Put the jar files you want to endorse here. If that directory does not exist just create it.

Another option is to put the jars in a directory of your own preference, but override the system property by adding a command line switch -Djava.endorsed.dirs=<Your endorsed jars directory>.

无人问我粥可暖 2024-09-08 20:37:21

jre 中包含的 wsimport 和 wsgen 作为 exe 位于 jre/bin 目录中,如果您仍然从命令行调用它,它仍然会运行 Jax-WS 2.1 实现。

要更新到 Jax-WS 2.2,您需要从 jaxws 网站下载相关的 JAX-WS 2.2.X RI。

您需要将内容提取到您的计算机上。

您还需要将 jaxws-api.jar 和 jaxb-api.jar 复制到认可目录中(根据您的原始描述),

但是,您现在不使用 wsgen.exe 或 wsimport.exe (适用于您的项目)需要使用 jax-ws 2.2 更新/下载中提供的一个。

在从 JAX-WS 2.2 下载中提取的 jaxws-ri 目录中,您将看到一个 bin 目录和 4 个文件(wsgen.bat、wsgen.sh、wsimport.bat、wsimport.sh),这些是你需要运行它。

要运行它们,您必须设置 JAXWS_HOME 环境变量(有关详细信息,请参阅 wsgen/wsimport.bat/sh 文件)。

现在应该允许您使用 JDK 1.6 运行 JAX-WS 2.2

The wsimport and wsgen included in the jre are located in the jre/bin directory as exe and if you still call it from command line, it will still run the Jax-WS 2.1 implementation.

To update to Jax-WS 2.2, you need to download the relevant JAX-WS 2.2.X RI from the jaxws website.

You need to extract the contents onto your computer.

You also need to copy the jaxws-api.jar and jaxb-api.jar into the endorsed directory (as per your original description)

HOWEVER, instead of using wsgen.exe or wsimport.exe (as applicable to your project), you now need to use the one provided in the jax-ws 2.2 update/download.

In the jaxws-ri directory that you've extracted from your JAX-WS 2.2 download, you will see a bin directory and 4 files (wsgen.bat, wsgen.sh, wsimport.bat, wsimport.sh) and these are the ones which you need to run instead.

To run them, you have to set up the JAXWS_HOME environment variable (see the wsgen/wsimport.bat/sh files for details).

That should now allow you to run JAX-WS 2.2 with JDK 1.6

过潦 2024-09-08 20:37:21

它与您的环境变量无关。 %JAVA_HOME% 只是文档中的简写,不知道你在哪里安装了 Java 或者安装了哪个版本的 Java。

%JAVA_HOME% 指的是 JRE(非开发人员拥有的常规运行时)。 %JDK_HOME% 指的是 JDK(Java 开发工具包)的 rood 目录,开发人员会使用该目录。

更重要的是,您必须知道何时运行 wsgen,它是从哪里运行的,并且相应的 JVM 配置有包含 jar 的认可目录。

It isn't tied to your environment variables. %JAVA_HOME% is just shorthand in the documentation that doesn't know where you installed Java or what version of Java you installed.

%JAVA_HOME% refers to a JRE (the regular runtime a non-developer would have). %JDK_HOME% refers to the rood directory of a JDK, a Java Development Kit, something a developer would use.

More than that, you have to know when you run wsgen where it is being run from, and that the corresponding JVM is configured with an endorsed directory that contains the jars.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文