what is the exact way to use Endorsed directory in jdk1.6
Asked Answered
B

3

8

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

Bootstrap answered 18/5, 2010 at 17:15 Comment(0)
S
1

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

Sinus answered 1/12, 2016 at 11:11 Comment(1)
thanks! as you might guess I don't need 6 years after the question :) but maybe helps someoneBootstrap
T
12

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>.

Tetramethyldiarsine answered 14/7, 2012 at 9:39 Comment(0)
T
1

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.

Tetrachloride answered 18/5, 2010 at 17:52 Comment(2)
no matter where wsgen is being run, as I have JAVA_HOME%\bin in the path. So the wsgen.exe will always be the one in there. But I hoped it would load the jars in the endorsed dir or somethingBootstrap
The question was about how to endorse?Aubarta
S
1

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

Sinus answered 1/12, 2016 at 11:11 Comment(1)
thanks! as you might guess I don't need 6 years after the question :) but maybe helps someoneBootstrap

© 2022 - 2024 — McMap. All rights reserved.