boo lean - Go FAT
boo lean - Go FAT

Reputation: 11

how to prevent thinkorswim's illegal reflective access to java.lang.Classloader.user_paths (2022 - Azul Zulu JDK 11)

I see many illegal reflective access related questions. As of recent ThinkOrSwim has finally implemented that JAVA 11 (the Azul Zulu openJDK 11) be used to launch thinkorswim. It has been warning this day would come. I have "updated" my java version to the extent of my knowledge, but am still receiving the following errors...

jesse@jesse-G74Sx:/$ cd /home/jesse/Programs/thinkorswim/thinkorswim
jesse@jesse-G74Sx:~/Programs/thinkorswim/thinkorswim$ sudo java -jar launcher.jar
[sudo] password for jesse: 
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.devexperts.jnlp.JavaLibraryPathUpdater (file:/home/jesse/Programs/thinkorswim/thinkorswim/suit/1975.0.80/tos-suit-1975.0.80.jar) to field java.lang.ClassLoader.usr_paths
WARNING: Please consider reporting this to the maintainers of com.devexperts.jnlp.JavaLibraryPathUpdater
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
Sep 27, 2022 8:08:06 PM com.devexperts.ssl.UrlStreamHandlerFactoryInstaller install
INFO: URL stream handler factory installed
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.CustomTrustManager <init>
INFO: Creating...
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.CustomTrustManager <init>
INFO: System truststore is enabled
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.CustomTrustManager getSystemTrustManagers
INFO: Got 1 system trust manager(s)
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.CustomTrustManager <init>
INFO: External truststore is enabled
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.ExternalTrustManagerFactory getCertificates
INFO: Creating certificates...
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.ExternalTrustManagerFactory getCertificates
INFO: Created 3 certificate(s)
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.ExternalTrustManagerFactory getTrustManagers
INFO: Created 1 trust manager(s) for external certificates
Sep 27, 2022 8:08:24 PM com.devexperts.ssl.CustomTrustManager <init>
INFO: The custom trust manager has been created

I have updated my $PATH variable to show the zulu11 bin...

jesse@jesse-G74Sx:/$ echo $PATH
/usr/lib/jvm/zulu11/bin:/home/jesse/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin

I have updated alternatives to force the 'java' command to use the correct repo..

jesse@jesse-G74Sx:/$ sudo update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                             Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/zulu11/bin/java      2115801   auto mode
* 1            /usr/lib/jvm/zulu11/bin/java      2115801   manual mode
  2            /usr/lib/jvm/zulu8/jre/bin/java   1806401   manual mode

Press <enter> to keep the current choice[*], or type selection number: 1

I then updated my etc/environment file to force $JAVA_HOME to be the corresponding repo by adding the following JAVA_HOME line below the PATH variable line...

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin"

JAVA_HOME="/usr/lib/jvm/zulu11/"

i dont seem to actually be changing the JAVA_HOME variable,

jesse@jesse-G74Sx:/$ echo $JAVA_HOME

jesse@jesse-G74Sx:/$ 

however, my main concern is that i need to show other repo's when i run update-alternatives... currently "/usr/lib/jvm/zulu11/bin/java" really ought to be showing another folder from my 'usr/lib/jvm' files ie.

jesse@jesse-G74Sx:/$ cd usr/lib/jvm
jesse@jesse-G74Sx:/usr/lib/jvm$ ls
zulu11  zulu-11-amd64  zulu11-ca-amd64  zulu8  zulu-8-amd64  zulu8-ca-amd64
jesse@jesse-G74Sx:/usr/lib/jvm$ 

i think if i can get alternatives to show "zulu-11-amd64" or "zulu11-ca-amd64" and could set one of those to the 'java' command, THEN i would have the newer version...

Either my paths are crossed up, or i need to try a different "alternative" but i havent a clue how to get more alternatives listed, nor how to sufficiently set JAVA_HOME..

ps. the only official documentation on how to do this is posted on td's website here

Upvotes: 0

Views: 1123

Answers (1)

Speakjava
Speakjava

Reputation: 3392

To start with, you should run java -version from where you are running your application. That will clarify which JDK you are actually using.

As the comment says, you are only seeing warnings about illegal reflective access. This is a result of changes between JDK 8 and JDK 9, encapsulating the JDK's internal APIs (which obviously also affect JDK 11). See JEP 260 (https://openjdk.org/jeps/260)

Have a look at this answer on StackOverflow, which goes into more detail and provides some suggestions if you really want to get rid of the messages. What is an illegal reflective access?

Upvotes: 0

Related Questions