peer
peer

Reputation: 4699

Supplied javaHome is not a valid folder in eclipse

I have migrated a workspace to a new machine with a different java distribution. The old machine had java-11-openjdk-amd64. The new one has only corretto.

Upon opening the old workspace on the new machine I get some problems, such as

Supplied javaHome is not a valid folder. You supplied: /usr/lib/jvm/java-11-openjdk-amd64 line 0 Gradle Error Marker

So in the workspace I deleted .metadata and I searched the workspace (and ~/.eclipse, ~/.gradle just in case) for references to the old version with

grep -r "/usr/lib/jvm/java-11-o"

There are no results. I have made sure that no eclipse processes are running (ps -aux | grep eclipse) and restarted eclipse, but the errors remain. What else can I do before creating new project and manually copying the code?

Upvotes: 2

Views: 4959

Answers (2)

rzwitserloot
rzwitserloot

Reputation: 102902

Sounds like the right place to edit this is in the eclipse preferences, and/or that eclipse is picking this up from an erroneously set JAVA_HOME environment variable.

Window > Preferences > search the filterbox for 'installed' to get to 'Installed JREs', remove any entries that don't seem right and add your coretto install here.

Next check Window > Preferences > Gradle > Arguments > Java Home, and fix things here. Most likely you can just select 'workspace JRE' and that should fix the problem.

If that doesn't work out, there's always the option of adding to your ~/.gradle file a single line with:

org.gradle.java.home=/path/to/coretto

Upvotes: 3

user21221615
user21221615

Reputation: 1

I received an update to my VM and the previous Pref>Gradle>Arg>Java Home no longer existed. I cut and pasted in one that did... Unfortunately, this did not work. I had to come through Eclipse and use the file navigation to get to the new Java Home I wanted to use. (Then do a Gradle>Refresh Gradle Project to get it to take).

Upvotes: 0

Related Questions