0

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

2 Answers2

0

.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.

Alex Chacha
  • 423
  • 2
  • 7
  • Thanks, but that didn't seem to help. Either with my original .profile setup, or the one you just offered when I echo the variables in the terminal I get the same (seemingly correct) result. But I am wondering, should the PATH variable not end with /bin and not /java as you have it? – user1868134 Jan 24 '13 at 16:54
0

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