In Eclipse you can override the workspace default JRE with the project JRE. But I'm almost certain you can't do it the other way around, which is what you would need to solve this problem in a pretty way.
But maybe you can solve the problem in the following way (which is a bit of a hack):
The project JRE specification is stored in Eclipse in the .classpath
file in the project directory.
.classpath
looks like this if the project has a specific JRE configured:
(Note the classpathentry kind="con"
entry.)
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk-14.0.2+12">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
Without a specified JRE .classpath
looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
<attributes>
<attribute name="module" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
If these files are updated Eclipse picks up the change to the project settings.
- Maybe you can create a script to update the submitted files to get the
classpath
entry that you need?
- Maybe you can simply copy-and-paste the
.classpath
file from a working project? This might save a couple of manual steps compared to changing the project configuration through the GUI.