Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get the Rhodes framework installed so I can develop Android apps.

This requires that I install the SUN JDK and add JAVA_HOME and JAVA_HOME/bin to path.

I thought I could solve this by editing my bash.bashrc file:

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

This still doesn't work, because when I run:

rake run:android

I get a prompt in the console that says the Java bin was not found in my path.

However, running echo $PATH gets me:

usernamee@ubuntu:~$ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/username/ruby/gems/bin:/usr/lib/jvm/java-6-sun/jre/bin/java/bin:/home/username/ruby_files/android-sdk-linux_86/tools

What are my options here?

Edit: If the problem is not the export statement, how can I ensure that the Sun JDK is properly installed and that I am, in fact, pointing to the correct path in bashrc?

share|improve this question
run echo $JAVA_HOME in a terminal. What does that give you? Also, lose the "export" statement, should be unnecessary and might be what's giving you the problem. – Naftuli Tzvi Kay Dec 23 '10 at 22:24
username@ubuntu:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-sun/jre/bin/java – user20285 Dec 23 '10 at 22:30

Try removing the export statement:

JAVA_HOME = /path/to/java

Then echo $JAVA_HOME in a new terminal to make sure you've got things exported correctly.


Alternatively, try this:

export JAVA_HOME=/path/to/java
export PATH=$PATH:$JAVA_HOME/bin
share|improve this answer
username@ubuntu:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-sun/jre/bin/java – user20285 Dec 23 '10 at 22:31
Did you edit your .bashrc file? Did it work? – Naftuli Tzvi Kay Dec 23 '10 at 22:38
Yes, I took out the export statement, then opened a new shell. Still same problem. – user20285 Dec 23 '10 at 22:43
Try new above edits. – Naftuli Tzvi Kay Dec 23 '10 at 22:50
Same problem. I think the issue is tied to my java installation. Should I delete everything from my jvm folder, then start from scratch? – user20285 Dec 23 '10 at 23:04

Since you're on Ubuntu, and it seems that you are using the default packages of Sun's Java for the OS, you should probably use the `update-alternatives' command. As you can see, I have 2 JVM's installed, but the Sun version is the one that gets used by default.

root@workstation:~# update-alternatives --query java
Link: java
Status: manual
Best: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Value: /usr/lib/jvm/java-6-sun/jre/bin/java

Alternative: /usr/lib/jvm/java-6-openjdk/jre/bin/java
Priority: 1061
 java.1.gz /usr/lib/jvm/java-6-openjdk/jre/man/man1/java.1.gz

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

If you only have one, you don't have to worry about it. If you have more than one, and need to set it, you can use the Java-specific version of the command, `update-java-alternatives'. It's all here:

share|improve this answer
And, now that I think about it, shouldn't this go to the "Ask Ubuntu" StackExchange site? – David Krider Mar 22 '11 at 12:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .