0

I installed the latest JDK 17, only to notice that my JHipster Version was not compatible with it. Naturally, I decided to delete the JDK. Unfortunately, after that Ubuntu did not seem to recognize my other installed Java Versions.

I ended up adding this to the end of my ~./bashrc:

#SETUP JAVA HOME
export JAVA_HOME="/usr/lib/jvm/java-1.11.0-openjdk-amd64"
export PATH=$PATH:$JAVA_HOME/bin

I can see the right version of the JDK when doing "java -version", but when I run my mvnw.sh JHipster build script, it says

Error: JAVA_HOME is not defined correctly.

Anything I did wrong? Starting the app with Intellij still works fine...

  • Have you sourced your `.bashrc` file in the open terminal session? What does `echo $JAVA_HOME` outputs? – tmarwen Nov 13 '21 at 13:00
  • Hi, thanks for your comment! It outputs "/usr/lib/jvm/java-1.11.0-openjdk-amd64" – Marc Philippe Beaujean Nov 13 '21 at 14:33
  • What does `which java` command outputs? Have you installed a JDK or a JRE? – tmarwen Nov 13 '21 at 18:48
  • which java is empty -- I believe I installed the JDK. – Marc Philippe Beaujean Nov 13 '21 at 19:23
  • Could you list the contents of the new installed JDK folder? How comes you said `java -version` outputs 11 as version and the shell is unable to recognize it? – tmarwen Nov 13 '21 at 19:31
  • Ahh sorry, it was because I accidentally changed the java path for a test. Which java with the provided path outputs the following: "/usr/lib/jvm/java-1.11.0-openjdk-amd64/bin/java" .... the contents of that new folder (ls) shows "bin conf docs include jmods legal lib man release" – Marc Philippe Beaujean Nov 14 '21 at 10:58
  • Would you mind adding the full output log for running `./mvnw.sh` in a clean terminal window? – tmarwen Nov 14 '21 at 11:15
  • (base) marc@marc-Lenovo-V130-15IKB:~/projects/my-project$ sudo ./mvnw Error: JAVA_HOME is not defined correctly. We cannot execute (base) marc@marc-Lenovo-V130-15IKB:~/projects/my-project$ echo $JAVA_HOME /usr/lib/jvm/java-1.11.0-openjdk-amd64 – Marc Philippe Beaujean Nov 15 '21 at 08:40

0 Answers0