[TIMOB-15818] CLI: Android: Incorrect JAVA_HOME passed into titanium_prep
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Critical |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2013-11-26T00:56:27.000+0000 |
Affected Version/s | Release 3.2.0 |
Fix Version/s | 2013 Sprint 24, 2013 Sprint 24 Core, Release 3.2.0 |
Components | Android, CLI |
Labels | qe-closed-3.2.0, triage |
Reporter | Chris Barber |
Assignee | Chris Barber |
Created | 2013-11-25T22:30:54.000+0000 |
Updated | 2013-12-19T02:19:29.000+0000 |
Description
When building for device in Linux (Ubuntu in this case), the build fails if JAVA_HOME is incorrect.
...
[INFO] Processing JavaScript files
[DEBUG] Copying and minifying /home/chris/Desktop/testapp/Resources/app.js => /home/chris/Desktop/testapp/build/android/assets/app.js
[INFO] Encrypting JavaScript files: /home/chris/.titanium/mobilesdk/linux/3.2.0.v20131125103938/android/titanium_prep.linux64 "com.appcelerator.testapp" "/home/chris/Desktop/testapp/build/android/assets" "app.js" "_app_props_.json"
[ERROR] Failed to encrypt JavaScript files
[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable.
JAVA_HOME is required for titanium_prep to run. If it's not set, then the CLI will try to autodetect the JAVA_HOME and pass that into titanium_prep. If JAVA_HOME is set and is invalid, titanium_prep will error.
This will require changes to both the Titanium SDK and node-appc.
*node-appc*
node-appc's jdk detection library needs to improve JAVA_HOME detection, specifically looking for JAVA_HOME/lib/<i386|amd64>/<client|server>/libjvm.so
or JAVA_HOME/jre/lib/<i386|amd64>/<client|server>
/libjvm.so. If these are not found, then it needs to add an issue JDK_INVALID_JAVA_HOME with description.
*Titanium SDK*
Android build needs to check if JDK_INVALID_JAVA_HOME is set and if so, fail.
Titanium Mobile pull request: https://github.com/appcelerator/titanium_mobile/pull/5024 node-appc pull request: https://github.com/appcelerator/node-appc/pull/70
@Chris - I do not see any test instructions in this ticket. Can you please provide with some test steps.
To test this, it's easiest to test on Windows since you can unset the JAVA_HOME and run "ti config java.home /path/to/jdk".
Verified fixed on: Windows 7, 8 and 8.1 CLI: 3.2.0-cr3 Titanium SDK, build: 3.2.0.v20131812153242 Followed test instruction from [~cbarber]. Removed all instances of the java location from the environment variables. Running ti info -t jdk displayed no jdk was found. Set java.home in ti config and the java location was found. Closing.