简体   繁体   中英

JAVA_HOME error in Titanium Studio on Linux Mint

I will try and keep this as concise as possible since I need to get this figured out quickly. Back when I setup Titanium Studio 2.1.1.201207271312 on Linux Mint 13 64-bit system, I had all kinds of problems installing a version of Java Titanium liked. In the end I Think I used the instructions here to get it working.

Now all these months later when I try to compile an app for Google Play I get this dreaded error:

[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOMenvironment variable. [ERROR] Unabled to prepare JavaScript for packaging. Error code 4.

Checking the java alteranatives on my system I get this:

'update-alternatives --query java
Link: java
Status: auto
Best: /usr/lib/jvm/java-6-sun/jre/bin/java
Value: /usr/lib/jvm/java-6-sun/jre/bin/java

Alternative: /usr/lib/jvm/java-6-sun/jre/bin/java
Priority: 63
Slaves:
java.1.gz /usr/lib/jvm/java-6-sun/jre/man/man1/java.1.gz

Alternative: /usr/lib/jvm/java-7-oracle/bin/java
Priority: 1
Slaves:
java.1.gz /usr/lib/jvm/java-7-oracle/man/man1/java.1.gz

I have the following set in my .profile

export JAVA_HOME=/usr/lib/jvm/java-6-sun/jre/bin/java

export PATH=$PATH:/usr/lib/jvm/java-6-sun/jre/bin/java

But still I get the error in Titanium. I have tried numerous different variations of my .profile file, but with no luck.

I really need to work this out quickly. Does anyone have any ideas?

EDIT: Solved

I seem to have worked the proper paths, here is how my .profile now reads:

JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_HOME

PATH=$PATH:/usr/lib/jvm/java-6-sun
export PATH

.profile is usually processed by sh, while .bash_profile is processed by bash (and instead of .profile when present). Try following sh compatible format (which has bitten me before when mucking with .profile files):

JAVA_HOME=/usr/lib/jvm/java-6-sun
export JAVA_HOME
PATH=$PATH:/usr/lib/jvm/java-6-sun/bin:/usr/lib/jvm/java-6-sun/jre/bin
export PATH

I Corrected to what I usually use, I was just echoing your values, but I should have been more careful. I usually have JDK and JAVA_HOME is supposed to be the base for it and then I add bin for both JDK and JRE. If you compiling then you may need the JDK and not just the JRE.

I seem to have worked out the proper paths, here is how my .profile now reads:

JAVA_HOME=/usr/lib/jvm/java-6-sun/jre
export JAVA_HOME

PATH=$PATH:/usr/lib/jvm/java-6-sun
export PATH

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM