Detect java not being in PATH at all, document java PATH requirement

This commit is contained in:
baldurk
2022-06-30 13:51:26 +01:00
parent 7990254bc0
commit 6870329a9e
2 changed files with 7 additions and 1 deletions
+2
View File
@@ -118,6 +118,8 @@ export ANDROID_NDK=<path_to_ndk_root>
export JAVA_HOME=<path_to_jdk_root>
```
You must also make sure that you have the `java` from `JAVA_HOME` in your `PATH`, as some Android build commands run java directly without respecting `JAVA_HOME`.
Otherwise, below are steps to acquire the tools for each platform. These steps download specifically the versions listed above, other versions may work but are not guaranteed.
### Android Dependencies on Windows
+5 -1
View File
@@ -92,9 +92,13 @@ if(ANDROID)
set(SAVE_JAVA_HOME $ENV{JAVA_HOME})
set(ENV{JAVA_HOME} "")
find_package(Java REQUIRED)
find_package(Java)
set(ENV{JAVA_HOME} ${SAVE_JAVA_HOME})
if(NOT ${Java_FOUND})
message(FATAL_ERROR "Building Android requires the 'java' program in your PATH. It must be at least Java 8 (1.8)")
endif()
if(${Java_VERSION} VERSION_LESS 1.8)
message(FATAL_ERROR "Building Android requires the 'java' program in your PATH to be at least Java 8 (1.8)")
endif()