1

I am running current setup:

  • OS: Win10
  • Java: 1.8 AdoptOpenJDK (JDK + JRE)
  • Mule: 4.2.1 / Anypoint Studio 7.9
  • Maven: embedded in Studio - 3.6.3

The issue is:

Unable to execute Java command.  The system cannot find the file specified. (0x2)
"C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.282.8-hotspot\\bin\\bin\\javaw.exe" -version
Failed to retrieve the version of Java. Resolving to the lowest supported version (1.4).
Launching a JVM...
Unable to execute Java command.  The system cannot find the file specified. (0x2)
"C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.282.8-hotspot\\bin\\bin\\javaw.exe"

Win10 environments:

  • C:\Users\1>echo %JAVA_HOME% - C:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot
  • C:\Users\1>echo %PATH% - C:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\bin;C:\apache-maven-3.8.1-bin\apache-maven-3.8.1\bin;

That is a tip from Studio project run below the issue description:

Advice:
Usually when the Wrapper fails to start the JVM process, it is
because of a problem with the value of the configured Java command.
Currently:
wrapper.java.command=C:\\Program Files\\AdoptOpenJDK\\jdk-8.0.282.8-hotspot\\bin\\bin\\javaw.exe
Please make sure that the PATH or any other referenced environment
variables are correctly defined for the current environment.

But it tells me nothing except system env vars but they look correct.

What I have tried:

  • Checking environment variables (system and user) - everything is fine, also checked with a teammate to be sure
  • Anypoint Studio checks: runs correct (1.8) Java, Maven (3.6.3) and Mule (4.2.1)
  • Maven and Studio config files - everything is also correct (uses %JAVA_HOME%)

I have no idea where is Studio taking this second "bin" from, thank you for all advices.

Anseal
  • 25
  • 7

2 Answers2

1

What's about confuguration mentioned in this answer and this one?

Seems like IDEs manage JDK in more sophisticated ways, similar steps helped me to configure my IDEA

rocket-3
  • 26
  • 4
  • That answer asks for JRE to JDK change, I have set JDK only: C:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\bin so I don't think thats the point, but I will dive deeper into this tommorow, thanks. – Anseal Aug 23 '21 at 15:08
  • My point is that you may need to confugure JDK settings in IDE internally. – rocket-3 Aug 23 '21 at 15:22
  • That was what I was looking for, but could not find any internal issue, but good point, thanks – Anseal Aug 24 '21 at 07:46
1

By default Anypoint Studio has its embedded version of OpenJDK to execute Mule projects. You can select an alternative one from the UI in Preferences / Java / Installed JREs (serves for both JDKs and JREs). It seems that this is the case because the error refers to a JDK installed outside Studio. Ensure that the location of the Java 8 SDKs configured point to the 'home' directory of the JDK (in your case it seems to be C:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot) rather than to the bin subdirectory (C:\Program Files\AdoptOpenJDK\jdk-8.0.282.8-hotspot\bin). Studio will assume the Java executable is under the bin subdirectory of the JDK home.

aled
  • 21,330
  • 3
  • 27
  • 34
  • Not sure if that solved the issue, but I had, as you mentioned, \bin at the end of java. After removing it the project came up with another error: `Error: Could not create the Java Virtual Machine. Error: A fatal exception has occured. Program will exit.` – Anseal Aug 24 '21 at 07:23
  • This is possibly another issue not related to that one: `Launching a JVM... Unrecognized option: -M-XX:MaxMetaspaceSize=2048m` That does not allow JVM to run, need to do research, but this is possibly a correct answer - to remove bin from Studio JDK path. – Anseal Aug 24 '21 at 07:31
  • That issue solved, params were not necessary, there are more problems but not related, to this one, thank you sir – Anseal Aug 24 '21 at 07:46