0

Maven is creating problems for me showing - The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE

This error came up when I updated the .mavenrc with JAVA_HOME - mavenrc content - export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home/bin/java

my 'which java' showing - /Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home/bin/java

Before updating the mavenrc file. when I was trying to do mvn package - showing - Could not find artifact com.sun:tools:jar:0 at specified path /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/../lib/tools.jar

I don't know what is the issue here. But m stuck and need help.

Saurabh Jhunjhunwala
  • 2,832
  • 3
  • 29
  • 57
Kaushik
  • 11
  • 2
  • 3
    Can you please try setting JAVA_HOME as - export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_331.jdk/Contents/Home/ – Vasanth Subramanian May 10 '22 at 06:25
  • Does this answer your question? [How to set JAVA\_HOME in Mac permanently?](https://stackoverflow.com/questions/14702702/how-to-set-java-home-in-mac-permanently) – seenukarthi May 10 '22 at 06:29
  • You can also use SDKMAN (https://sdkman.io/) on macOS to make it easy to install JDK's and Maven. – Wim Deblauwe May 10 '22 at 06:41
  • Based on that `showing - Could not find artifact com.sun:tools:jar:0` I would check the used project because using a project which usses tools.jar is very old and outdated.... – khmarbaise May 10 '22 at 07:42

0 Answers0