This SO question asks how to get Eclipse to compile with the —patch-module javac option.
However, I have found no obvious and easy way to get Eclipse to run the compiled patched code using the same configuration.
i.e. to use the Build Path / Module Dependencies configuration described in the question above at Run / Debug time too.
After much fruitless hunting, I resorted to adding "—patch-module xxxx" to the Launch “Debug Configurations / Arguments / VM Arguments” to point to the folder containing the classes compiled by Eclipse. e.g.
--patch-module java.security.jgss=/Users/xxx/svn/JGSSDebug/bin
That worked, but is a bit brute force! Is there an easier way that I have missed?
Edit1
One can use Java Build Path / Module Dependencies / Show JPMS Options from the project JGSSDebug to get the correct command line syntax, and manually paste to the VM Arguments of the Launch Configuration of the project JGSSDebug-Test. (...just don't forget to change "src" to "bin" at the end of the path ...). The first time round I worked the syntax myself.
End Edit1
I am running Eclipse Version: 2021-03 (4.19.0) Build id: 20210312-0638
Background:
In order to troubleshoot problems with SPNEGO SSO we want to enrich classes in the JRE module java.security.jgss with additional log output.
I have created two Eclipse Projects:
JGSSDebug This project contains the java.security.jgss classes we will patch with log output. The .classpath file contains:
<attribute name="patch-module" value="java.security.jgss=/JGSSDebug"/>'
JGSSDebug-Test This project will call code in java.security.jgss including the patched code in JGSSDebug. It depends on JGSSDebug:
<classpathentry combineaccessrules="false" kind="src" path="/JGSSDebug"/>
The only way I could find to make JGSSDebug-Test run the patched code was via the “VM Arguments” as described above.
Neither project has a module-info.java file.
We are using Azul OpenJDK 11.0.11 to compile and run.