1

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?

2
  • 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. Dec 23, 2010 at 22:24
  • username@ubuntu:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-sun/jre/bin/java
    – user20285
    Dec 23, 2010 at 22:30

2 Answers 2

1

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
8
  • username@ubuntu:~$ echo $JAVA_HOME /usr/lib/jvm/java-6-sun/jre/bin/java
    – user20285
    Dec 23, 2010 at 22:31
  • 1
    Did you edit your .bashrc file? Did it work? Dec 23, 2010 at 22:38
  • Yes, I took out the export statement, then opened a new shell. Still same problem.
    – user20285
    Dec 23, 2010 at 22:43
  • Try new above edits. Dec 23, 2010 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, 2010 at 23:04
1

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

1
  • And, now that I think about it, shouldn't this go to the "Ask Ubuntu" StackExchange site? Mar 22, 2011 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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