Skip to content

Verify JAVA_HOME is set correctly #1587

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 9, 2016

Conversation

rosen-vladimirov
Copy link
Contributor

Our system requirements point that JAVA_HOME must be set, but tns doctor is not strict about this.
With version 1.7.0 of the runtime, jarsigner from $JAVA_HOME/bin/jarsigner will be called explicitly, so we must be sure JAVA_HOME is correct.
jarsigner does not exist in JRE, so add logic to call it in order to verify that the currently set JAVA_HOME is correct.
Validate the information in the following order:

  1. Check if JAVA_HOME is set. In case it is not, you cannot build for Android (tns build android will fail before starting).
  2. Check if JAVA_HOME is correct by executing JAVA_HOME/bin/jarsigner - in case it does not exist - fail
  3. Check if the version of the JAVA is correct by calling JAVA_HOME/bin/javac -version and compare it with min required one. In case it's lower - fail.

tns doctor will print warning in case any of the above check fails. tns build android and any other Android related build operations will fail.

Our system requirements point that JAVA_HOME must be set, but `tns doctor` is not strict about this.
With version 1.7.0 of the runtime, `jarsigner` from $JAVA_HOME/bin/jarsigner will be called explicitly, so we must be sure JAVA_HOME is correct.
`jarsigner` does not exist in JRE, so add logic to call it in order to verify that the currently set JAVA_HOME is correct.
Validate the information in the following order:
1) Check if JAVA_HOME is set. In case it is not, you cannot build for Android (`tns build android` will fail before starting).
2) Check if JAVA_HOME is correct by executing JAVA_HOME/bin/jarsigner - in case it does not exist - fail
3) Check if the version of the JAVA is correct by calling JAVA_HOME/bin/javac -version and compare it with min required one. In case it's lower - fail.

`tns doctor` will print warning in case any of the above check fails. `tns build android` and any other Android related build operations will fail.
@rosen-vladimirov rosen-vladimirov self-assigned this Mar 9, 2016
@rosen-vladimirov rosen-vladimirov added this to the 1.7.0 milestone Mar 9, 2016
@rosen-vladimirov
Copy link
Contributor Author

ping @Plamen5kov , @slavchev , @teobugslayer

@slavchev
Copy link

slavchev commented Mar 9, 2016

👍
related to NativeScript/android@321c51a

@Plamen5kov
Copy link
Contributor

👍

@vchimev
Copy link

vchimev commented Mar 9, 2016

run ci

rosen-vladimirov added a commit that referenced this pull request Mar 9, 2016
@rosen-vladimirov rosen-vladimirov merged commit 62b1dfb into release Mar 9, 2016
@rosen-vladimirov rosen-vladimirov deleted the vladimirov/verify-java-home branch March 9, 2016 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants