Skip to content
This repository has been archived by the owner on Feb 4, 2023. It is now read-only.

Cannot find Java home on BigSur 11.1 #100

Closed
1 of 3 tasks
lqlau opened this issue Jan 26, 2021 · 3 comments
Closed
1 of 3 tasks

Cannot find Java home on BigSur 11.1 #100

lqlau opened this issue Jan 26, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@lqlau
Copy link

lqlau commented Jan 26, 2021

I'm submitting a…

  • bug report
  • feature request
  • other

Short description of the issue/suggestion:
This is the Java output when running commands from terminal:

~ % /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    1.8.0_282 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home
    1.8.0_272 (x86_64) "Amazon" - "Amazon Corretto 8" /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home

~ % /usr/libexec/java_home --xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
	<dict>
		<key>JVMArch</key>
		<string>x86_64</string>
		<key>JVMBundleID</key>
		<string>net.adoptopenjdk.8.jdk</string>
		<key>JVMEnabled</key>
		<true/>
		<key>JVMHomePath</key>
		<string>/Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home</string>
		<key>JVMName</key>
		<string>AdoptOpenJDK 8</string>
		<key>JVMPlatformVersion</key>
		<string>1.8.0_282-b08</string>
		<key>JVMVendor</key>
		<string>AdoptOpenJDK</string>
		<key>JVMVersion</key>
		<string>1.8.0_282</string>
	</dict>
	<dict>
		<key>JVMArch</key>
		<string>x86_64</string>
		<key>JVMBundleID</key>
		<string>com.amazon.corretto.8</string>
		<key>JVMEnabled</key>
		<true/>
		<key>JVMHomePath</key>
		<string>/Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home</string>
		<key>JVMName</key>
		<string>Amazon Corretto 8</string>
		<key>JVMPlatformVersion</key>
		<string>1.8</string>
		<key>JVMVendor</key>
		<string>Amazon</string>
		<key>JVMVersion</key>
		<string>1.8.0_272</string>
	</dict>
</array>
</plist>

This is the console log:

default	08:09:20.463280-0800	syslog	[50825][universalJavaApplicationStub] [StubDir] /Applications/Test Software.app/Contents/MacOS
default	08:09:20.477005-0800	syslog	[50825][Test Software] [PlistStyle] Apple
default	08:09:20.530448-0800	syslog	[50825][Test Software] [JavaRequirement] JVM minimum version: 1.8+
default	08:09:20.533828-0800	syslog	[50825][Test Software] [JavaRequirement] JVM maximum version:
default	08:09:20.544742-0800	syslog	[50825][Test Software] [Language] en_CA
default	08:09:20.554658-0800	syslog	[50825][Test Software] [JavaSearch] Checking for $JAVA_HOME ...
default	08:09:20.558073-0800	syslog	[50825][Test Software] [JavaSearch] ... found JAVA_HOME with value Contents/Resources/Frameworks/adoptopenjdk-8.jdk/Contents/Home
default	08:09:20.569880-0800	syslog	[50825][Test Software] [JavaSearch] Searching for JavaVirtualMachines on the system ...
default	08:09:20.585433-0800	syslog	[50825][Test Software] [JavaSearch] ... found JVM: :/bin/java
default	08:09:20.588815-0800	syslog	[50825][Test Software] [JavaSearch] Filtering the result list for JVMs matching the min/max version requirement ...
default	08:09:20.607095-0800	syslog	[50825][Test Software] [JavaCommand] ''
default	08:09:20.613929-0800	syslog	[50825][Test Software] [JavaVersion]
default	08:09:20.620956-0800	syslog	[50825][Test Software] [EXIT 3] No suitable Java version found on your system!
This program requires Java  8 or later.

I'm using universalJavaApplicationStub 3.1.0.

Steps to reproduce the issue/enhancement:

  1. [First Step]
  2. [Second Step]
  3. [Other Steps...]

What is the expected behavior?

What is the current behavior?

Do you have screenshots, GIFs, demos or samples which demonstrate the problem or enhancement?

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

  • universalJavaApplicationStub version: 3.1.0
  • Mac OS version: BigSur 11.1
  • Java version(s): 1.8

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

@tofi86
Copy link
Owner

tofi86 commented Jan 26, 2021

The launcher found a JAVA_HOME property with the value :/bin/java but this isn't a valid path to a Java Home directory...

Please unset or fix the JAVA_HOME environment variable as it takes precedence over any other values.

@lqlau
Copy link
Author

lqlau commented Jan 27, 2021

Thank for the fast reply. I don't think ":/bin/java" is due to JAVA_HOME. In my Info.plist file, I do define JAVA_HOME:

    <key>LSEnvironment</key>
<dict>
    <key>JAVA_HOME</key>
	<string>Contents/Resources/Frameworks/amazon-corretto-8.jdk/Contents/Home</string>
</dict>

Once I copied the JDK into the Frameworks folder, everything just works now. It wasn't there before and so the universalJavaApplicationStub began to look for Java on my system and I guess it found ":/bin/java" somehow.

@tofi86 tofi86 added this to the Version 3.1.1 milestone Feb 3, 2021
@tofi86 tofi86 self-assigned this Feb 3, 2021
@tofi86 tofi86 added the patch label Feb 3, 2021
@tofi86
Copy link
Owner

tofi86 commented Feb 3, 2021

Ah well, you're right...

Now that I formatted your initial post with proper codeblocks I see the problem. Sorry for not having seen this in the first place.

I added some more debug logging for this case with commit 0880026

20:26:15.320409+0100	[5775][App] [JavaSearch] Checking for $JAVA_HOME ...
20:26:15.331929+0100	[5775][App] [JavaSearch] ... found JAVA_HOME with value Contents/Resources/Frameworks/amazon-corretto-8.jdk/Contents/Home
20:26:15.339730+0100	[5775][App] [JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '/Users/xxxxx/dev/universalJavaApplicationStub/test/test.app/Contents/Resources/Frameworks/amazon-corretto-8.jdk/Contents/Home/bin/java'
20:26:15.361691+0100	[5775][App] [JavaSearch] ... but no 'java' executable was found at the JAVA_HOME location!

The found JVM: :/bin/java resulted from another issue (#93) where /usr/libexec/java_home/ did not return any registered JDKs. This has been fixed in the meantime.

So this process should be more stable now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants