Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
1  
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
add comment

2 Answers

Try removing the export statement:

JAVA_HOME = /path/to/java
PATH = $PATH:$JAVA_HOME/bin

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

echo $JAVA_HOME

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
1  
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
show 3 more comments

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
Slaves:
 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
Slaves:
 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:

https://help.ubuntu.com/community/Java

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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.