Skip to content

Commit 528e199

Browse files
committed
Update error message.
For the case where Java cannot be found in the Windows Registry, display an error message that points the user to a location for downloading Java and then instructs the user to reload JavaCall.
1 parent ab31bdf commit 528e199

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/jvm.jl

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,21 @@ const JNI_EEXIST = convert(Cint, -5) #/* VM already created *
1717
const JNI_EINVAL = convert(Cint, -6) #/* invalid arguments */
1818

1919
function javahome_winreg()
20-
try
21-
keypath = "SOFTWARE\\JavaSoft\\Java Runtime Environment"
22-
value = querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "CurrentVersion")
23-
keypath *= "\\"*value
24-
return querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "JavaHome")
25-
catch
26-
keypath = "SOFTWARE\\JavaSoft\\Java Development Kit"
27-
value = querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "CurrentVersion")
28-
keypath *= "\\"*value
29-
return querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "JavaHome")
30-
end
20+
try
21+
keypath = "SOFTWARE\\JavaSoft\\Java Runtime Environment"
22+
value = querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "CurrentVersion")
23+
keypath *= "\\"*value
24+
return querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "JavaHome")
25+
catch
26+
try
27+
keypath = "SOFTWARE\\JavaSoft\\Java Development Kit"
28+
value = querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "CurrentVersion")
29+
keypath *= "\\"*value
30+
return querykey(WinReg.HKEY_LOCAL_MACHINE, keypath, "JavaHome")
31+
catch
32+
error("Cannot find an installation of Java in the Windows Registry. Please install Java from https://java.com/en/download/manual.jsp and subsequently reload JavaCall.")
33+
end
34+
end
3135
end
3236

3337
@static is_unix() ? (global const libname = "libjvm") : (global const libname = "jvm")

0 commit comments

Comments
 (0)