Project: appceleratorstudio
Issue TISTUD-1984: Pass in JAVA_HOME to Python scripts
While testing "Build Acceptance TIMOB-7472-A Android Only", I attempted to build a default Titanium Mobile app (just the standard template) and I encounter the following problem: {noformat} [DEBUG] /home/qatester/.titanium/mobilesdk/linux/2.1.0.GA/android/titanium_prep.linux64 com.shastaqa.fresh1 /home/qatester/Titanium_Studio_Workspace/fresh1/build/android/bin/assets/Resources ui/common/ApplicationTabGroup.js ui/handheld/ApplicationWindow.js app.js ui/tablet/ApplicationWindow.js [ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable. [ERROR] Unabled to prepare JavaScript for packaging. Error code 4. {noformat} I check and the $JAVA_HOME is set, but was not available to the Python script. Studio should check for the JAVA_HOME before beginning a build, check if it is correctly set, and if it is missing or incorrect pass in a correct version into the build. This issue is a not a regression since the bug is due to a user mis-configuration of JAVA_HOME. Steps used to reproduce: 1. Ensure that the $JAVA_HOME global variable is set ( ls -R $JAVA_HOME ). 2. Create a new Titanium Mobile Project. 3. Create a signing key. 4. Package for Distribution (Package > Distribute - Android App Store) Expected result: Android correctly packages and a package file is created in the specified place. Actual result: The packager gets to titanium_prep.linux64 where it can not find java as $JAVA_HOME isn't available to it. Tested by multiple sources on Titanium Studio build 2.1.1, 2.1.0, and 2.0.2 on both Ubuntu 12.04 and 10.04, using SDK 2.1.0GA replicated the same failure. Switching back to SDK 2.0.2GA fixes the issue in all studio platforms, as 2.1.0 is the first version to use JAVA_HOME in the packaging scripts. Suggested solution: * See if JAVA_HOME is set in such a way that the scripts can read it * If it is, check if the JAVA_HOME variable is correct by checking for /lib/tools.jar at that path * If it is incorrectly set, or not set, infer the JAVA_HOME location by using values from Studio's environment.
Story points: 13