Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » --add-opens in INI file not correctly used by launcher?
--add-opens in INI file not correctly used by launcher? [message #1849680] Sat, 29 January 2022 07:08 Go to next message
Anish Abraham is currently offline Anish AbrahamFriend
Messages: 9
Registered: April 2016
Junior Member
I have been developing an RCP application and recently switched from Java 11 to Java 17. For backward compatibility, we temporarily need to open several modules to `ALL-UNNAMED`. All the corresponding `--add-opens` were added to the end of the INI file. The resulting INI file looked similar to the following:
-startup
plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.1100.v20190907-0426
-vm
jdk17/bin
-data
@user.home/Documents/MyApp
-vmargs
-Djava.library.path=./javafx17-mod/bin
-Dorg.osgi.framework.bundle.parent=ext
-Defxclipse.java-modules.dir=./javafx17-mod/lib
--add-opens java.base/java.io=ALL-UNNAMED
--add-opens java.base/java.util=ALL-UNNAMED
--add-opens java.base/java.nio.file=ALL-UNNAMED


Oddly, the plugins that required the module opening would not work and threw errors specifically with the message that the very modules included above where NOT opened.

After trying several variations of ordering of the `vmargs`, I wrote a BAT file (I'm on Windows 10) to launch the application without the native launcher:

.\jdk17\bin\java ^
-jar plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar
-Djava.library.path=./javafx17-mod/bin ^
-Dorg.osgi.framework.bundle.parent=ext ^
-Defxclipse.java-modules.dir=./javafx17-mod/lib ^
--add-opens java.base/java.io=ALL-UNNAMED ^
--add-opens java.base/java.util=ALL-UNNAMED ^
--add-opens java.base/java.nio.file=ALL-UNNAMED ^


At first, this didn't solve the problem. However, when I moved the `-jar` argument to the very end, everything worked!

Is there a way to modify the INI file so that it passes the startup jar argument last to the JVM so that the `--add-opens` works?
Re: --add-opens in INI file not correctly used by launcher? [message #1849718 is a reply to message #1849680] Mon, 31 January 2022 07:49 Go to previous messageGo to next message
Rolf Theunissen is currently offline Rolf TheunissenFriend
Messages: 260
Registered: April 2012
Senior Member
Eclipse uses the JNI invocation API to launch the JVM, therefore an additional '=' is required [1], otherwise the arguments are incorrectly parsed.

e.g. try --add-opens=java.base/java.io=ALL-UNNAMED

[2] https://docs.oracle.com/javase/9/migrate/toc.htm#JSMIG-GUID-D867DCCC-CEB5-4AFA-9D11-9C62B7A3FAB1

Re: --add-opens in INI file not correctly used by launcher? [message #1849733 is a reply to message #1849718] Mon, 31 January 2022 15:16 Go to previous message
Anish Abraham is currently offline Anish AbrahamFriend
Messages: 9
Registered: April 2016
Junior Member
Thank you! That did the trick!
Previous Topic:HandlerUtil for isEnabled of handler
Next Topic:PKCS11 Java 11
Goto Forum:
  


Current Time: Mon Oct 07 05:43:45 GMT 2024

Powered by FUDForum. Page generated in 0.24457 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top