OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

The public knowledge pool and discussion forum of the OWS community. Do not post confidential information here!
mredeker
Posts: 6
Joined: 21 Jul 2023, 13:54

OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by mredeker »

We have an issue using latest OpenWebstart version on Mac OSX with Temurin17.
For our Swing Look&Feel we add multiple "--add-exports" and "--add-reads" to the JNLP file which is working fine with Windows and Temurin17.
But on Mac OSX it looks like that Temurin17 is not using those parameters.

The OpenWebstart log shows the following info:
[ITW-CORE][2023-07-20 18:12:53.420 MESZ][INFO ][com.openwebstart.launcher.OwsJvmLauncher] About to launch process with command:
/Library/Java/JavaVirtualMachines/temurin-17.jdk/Contents/Home/bin/java -Xbootclasspath/a:/Applications/OpenWebStart/openwebstart.jar --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED,java.desktop --add-exports=java.base/jdk.internal.util.jar=ALL-UNNAMED,java.desktop --add-exports=java.base/com.sun.net.ssl.internal.ssl=ALL-UNNAMED,java.desktop --add-reads=java.naming=ALL-UNNAMED,java.desktop --add-exports=java.desktop/sun.awt.X11=ALL-UNNAMED,java.desktop --add-exports=java.desktop/sun.applet=ALL-UNNAMED,java.desktop,jdk.jsobject --add-exports=java.base/sun.security.action=ALL-UNNAMED,java.desktop --add-reads=java.base=ALL-UNNAMED,java.desktop --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED,java.desktop --add-exports=java.naming/com.sun.jndi.toolkit.url=ALL-UNNAMED,java.desktop --add-exports=java.base/sun.security.util=ALL-UNNAMED,java.desktop --add-reads=java.desktop=ALL-UNNAMED,java.naming --add-exports=java.desktop/sun.awt=ALL-UNNAMED,java.desktop --add-exports=java.base/sun.security.x509=ALL-UNNAMED,java.desktop --add-exports=java.desktop/javax.jnlp=ALL-UNNAMED,java.desktop --add-exports=java.base/sun.security.provider=ALL-UNNAMED,java.desktop --add-exports=java.base/sun.security.validator=ALL-UNNAMED,java.desktop net.sourceforge.jnlp.runtime.Boot -Xnofork /Users/jacky/Downloads/Installation Mig/NEO-Mig/launch NEO Mig.jnlp
You can see that the correct Java version is used and also all "--add-exports" are used when launching the client.
But in our client application log we see the following error:
Caused by: java.lang.IllegalAccessError: class de.javasoft.plaf.synthetica.SyntheticaLookAndFeel (in unnamed module @0x4b9986d1) cannot access class sun.swing.DefaultLookup (in module java.desktop) because module java.desktop does not export sun.swing to unnamed module @0x4b9986d1
at de.javasoft.plaf.synthetica.SyntheticaLookAndFeel.initialize(SyntheticaLookAndFeel.java:683)
Anybody an idea what could be the problem or where I can post this issue for the Temurin team?

Thanks,
-Marcus

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

Did you try wih any other JVM (Oracle etc)?

Are you able to run the same app in stand alone mode on Mac by putting the downloaded jar files on the classpath. and starting the app using Temurin java 17?

Can you please send the OWS log of when the jnlp app runs successfully on windows and when the same jnlp app fails on Mac?

msc
Posts: 13
Joined: 09 Dec 2021, 07:18

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by msc »

Have you tried adding "--add-exports=java.desktop/sun.swing=ALL-UNNAMED" to the list?

mredeker
Posts: 6
Joined: 21 Jul 2023, 13:54

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by mredeker »

Hi guys, thanks for your feedback.

When testing with Oracle JDK17, I realized that it did not work either and took a deeper look when comparing the 2 logfiles.
I realized that not all "-add-exports=..." that we had defined showed up when using Mac, but they did with Windows.

We are using the JNLP feature with the <resource arch="..."> tag to define extra JVM parameter based on the client architecture.
The needed "--add-exports=..." were only defined for "arch=x86_64" and "arch=amd64".
We tested with an Intel based Mac which should be recognized from OpenWebstart as "x86_64" and an Apple Silicon Mac.
Both did not receive the additional JVM parameter.

After adding the needed parameters to the architectures "x86" and "i386" and also adding the architecture "aarch64" evertyhing is working :)
So for us the problem is solved.

There might be an issue on how OpenWebstart is resolving the architecture since the Mac with Intel chip is "x86_64" but was found as "x86".

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

Thanks for reporting. We will investigate.

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

I tried with the following jnlp file and it works ok om Mac OS X with arch x86_64:

Code: Select all

?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://192.168.2.104:8080/jnlp">
    <information>
        <title>JVM Args</title>
        <vendor>Karakun AG</vendor>
        <offline-allowed/>
    </information>
    <security>
        <all-permissions/>
    </security>
    <resources os="Windows 11" arch="amd64">
        <j2se version="17*"  java-vm-args=" -Xmx512m -Xms128m"/>
    </resources>
    <resources os="Mac OS X" arch="x86_64">
        <j2se version="17*"  java-vm-args=" -Xmx1024m -Xms64m"/>
    </resources>
    <resources>
        <jar href="generated-jars/jvm_args.jar"/>
    </resources>
    <application-desc main-class="com.karakun.ows.jvm_args.Form"/>
</jnlp>
For the above Jnlp file, correct vm args are picked up when running on Windows and Mac.

Can you please send me a sample Jnlp file like the above which I can use to reproduce your issue?

mredeker
Posts: 6
Joined: 21 Jul 2023, 13:54

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by mredeker »

The problem was that my Intel based Mac picked up the parameters from <resources arch="x86"> even though it is a "x86_64" architecture.
Here is a snippet of the NOT working file.

Code: Select all

  <resources arch="x86">
      <java version="1.8*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
      <java version="11*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
      <java version="17*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
  </resources>
  <resources arch="i386">
      <java version="1.8*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
      <java version="11*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
      <java version="17*" vendor="Eclipse Adoptium" initial-heap-size="512m" max-heap-size="1024m" />
  </resources>
  <resources arch="amd64">
      <java version="1.8*" vendor="Eclipse Adoptium"/>
      <java version="11*" vendor="Eclipse Adoptium" />
      <java version="17*" vendor="Eclipse Adoptium" java-vm-args="--add-exports=java.desktop/sun.swing=ALL-UNNAMED --add-exports=java.desktop/sun.swing.table=ALL-UNNAMED --add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.tree=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED" />
  </resources>
  <resources arch="x86_64">
      <java version="1.8*" vendor="Eclipse Adoptium"/>
      <java version="11*" vendor="Eclipse Adoptium" />
      <java version="17*" vendor="Eclipse Adoptium" java-vm-args="--add-exports=java.desktop/sun.swing=ALL-UNNAMED --add-exports=java.desktop/sun.swing.table=ALL-UNNAMED --add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.tree=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED" />
  </resources>
You can see that the "x86" architecture did not have the extra "java-vm-args" but the "x86_64" did have them.
But it did not work with Java17 on my Mac. Only after I added the extra "java-vm-args" also to the "x86" section it did work.

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

Ok Thanks for the sample. I will try to reproduce it.

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

I am able to reproduce the problem on Intel Mac with the following Jnlp file:

Code: Select all

...
    <resources arch="x86">
        <java version="17*" vendor="Eclipse Adoptium" initial-heap-size="511m" max-heap-size="1023m" />
		<jar href="generated-jars/jvm_args.jar"/>
    </resources>

    <resources arch="x86_64">
		<java version="17*" vendor="Eclipse Adoptium" java-vm-args="--add-exports=java.desktop/sun.swing=ALL-UNNAMED --add-exports=java.desktop/sun.swing.table=ALL-UNNAMED --add-exports=java.desktop/sun.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.synth=ALL-UNNAMED --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED --add-opens=java.desktop/javax.swing=ALL-UNNAMED --add-opens=java.desktop/javax.swing.tree=ALL-UNNAMED --add-opens=java.desktop/java.awt.event=ALL-UNNAMED --add-exports=java.desktop/com.sun.java.swing.plaf.windows=ALL-UNNAMED --add-exports=java.desktop/sun.awt.shell=ALL-UNNAMED --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/sun.security.action=ALL-UNNAMED --add-opens=java.desktop/java.beans=ALL-UNNAMED" />
	    <jar href="generated-jars/jvm_args.jar"/>
    </resources>
	
    <application-desc main-class="com.karakun.ows.jvm_args.Form"/>
</jnlp>
Happens with Java 11 too.

Janak Mulani
Posts: 847
Joined: 24 Mar 2020, 13:37

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by Janak Mulani »

Hi

The order in which the resources are specified matters. If you switch the order of x86 and x86_64 as follows it will pick up vmargs for x86_64:

Code: Select all

    <resources arch="x86_64">
		<java version="17*" vendor="Eclipse Adoptium" java-vm-args="--add-exports=java.desktop/sun.swing=ALL-UNNAMED .../>
	    <jar href="generated-jars/jvm_args.jar"/>
    </resources>

<resources arch="x86">
        <java version="17*" vendor="Eclipse Adoptium" initial-heap-size="511m" max-heap-size="1023m" />
		<jar href="generated-jars/jvm_args.jar"/>
    </resources>

mredeker
Posts: 6
Joined: 21 Jul 2023, 13:54

Re: OpenWebstart on Mac OSX and Temurin17; --add-exports Problem

Post by mredeker »

Thanks for the info.
Since I added the extra params to all architecture, the problem was solved that way :)

Post Reply