Announcement

Collapse
No announcement yet.

[Solved]Java/OpenLazslo installation : Java_home variable not defined

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [Solved]Java/OpenLazslo installation : Java_home variable not defined

    Hi
    I know this has been posted countless times but it doesn't seem to work for me.
    I am installing Java SDK (in order to install OpenLaszlo). And here's what I get when I try to run the script to make OL working :
    Code:
    $/usr/local/lps-4.3.0/Server/tomcat-5.0.24/bin$ sudo ./startup.sh
    The JAVA_HOME environment variable is not defined
    This environment variable is needed to run this program
    I have installed java ($sudo aptitude install sun-java6-jdk sun-java6-doc sun-java6-demo), agreed the agreement by downloading the doc to /tmp from Sun's website ; I did this to select Java as default ($sudo update-java-alternatives -s java-6-sun).
    I have added this in /home/.bashrc
    Code:
    if [ -d ~/bin ] ; then
      PATH=~/bin:/usr/lib/jvm/java-6-sun/jre/bin:"${PATH}"
    fi
    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    output of commands :
    Code:
    $ update-java-alternatives --list
    java-6-openjdk 1061 /usr/lib/jvm/java-6-openjdk
    java-6-sun 63 /usr/lib/jvm/java-6-sun
    Code:
    $ java -version
    java version "1.6.0_10"
    Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
    Java HotSpot(TM) 64-Bit Server VM (build 11.0-b15, mixed mode)
    Code:
    $ which java
    /usr/bin/java
    which is strange because it seems like the one it should be is /usr/lib/jvm/...

    I don't understand much of this, just trying to figure out the specific line which will end this installation !
    thanks in advance
    kl
    Single boot Kubuntu12.04 on Zepto NoxA14 Intel Dual Core 2GHz (64-bit), RAM 4Go, Nvidia GeForce 9600M GT

    #2
    Re: Java installation : Java_home variable not defined

    The Tomcat Server still needs the JAVA_HOME.

    I suggest you open the ~/.bash_profile and add the following line

    export JAVA_HOME=/usr/lib/jvm/java-6-sun
    Lenovo Thinkpad R60<br />Intel T5600 Core2Duo Processor @ 1.83Ghz<br />AD198x Intel Soundcard | NetXtreme BCM5751M Ethernet PCI express<br />Pro/wireless 3945ABG<br />1 GB RAM | 1024x768 Resolution | 1 X 80 GB SATA HD Internal<br />945GM/GMS,943/940GML Express Integrated Graphics Adapter<br />Using Kubuntu 9.04 w/KDE 4.2.2

    Comment


      #3
      Re: Java installation : Java_home variable not defined

      I have this same very line in ~/.bashrc
      I don't have a ~/.bash_profile, but in ~/.profile, it does include ~/.bashrc
      I think the problem is elsewhere because JAVA_HOME looks defined :
      Code:
      $ echo $JAVA_HOME
      /usr/lib/jvm/java-6-sun
      This is ~/.profile, I copied an extract of ~/.bashrc above.
      Code:
      # if running bash
      if [ -n "$BASH_VERSION" ]; then
        # include .bashrc if it exists
        if [ -f "$HOME/.bashrc" ]; then
      	. "$HOME/.bashrc"
        fi
      fi
      
      # set PATH so it includes user's private bin if it exists
      if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
      fi
      Single boot Kubuntu12.04 on Zepto NoxA14 Intel Dual Core 2GHz (64-bit), RAM 4Go, Nvidia GeForce 9600M GT

      Comment


        #4
        Re: Java installation : Java_home variable not defined

        You are running startup.sh with sudo which means you aren't using your ~/.bashrc file but the one for root. Try adding JAVA_HOME to /etc/profile and your problem should go away. The other option is run startup.sh as yourself instead of root.
        linux &amp;&amp; bash = &quot;the future&quot;

        Comment


          #5
          Re: Java installation : Java_home variable not defined

          Hi
          I didn't really understand your reply, but I tried $./startup.sh (without sudo) and it works. I think it does because my OpenLazslo folder is in /home and not in /usr/local where at some point superuser privileges would be required (to run catalina.sh)

          My former OL apps are working as well, which is great !
          Many thanks
          Single boot Kubuntu12.04 on Zepto NoxA14 Intel Dual Core 2GHz (64-bit), RAM 4Go, Nvidia GeForce 9600M GT

          Comment


            #6
            Re: [Solved]Java/OpenLazslo installation : Java_home variable not defined

            It has nothing to do with /home or /usr/local. The only time you run Tomcat as root is when you choose a port number lower than 1024 which requires root permissions on Linux; otherwise, you can run it as any user with permissions to the directory and files. The important thing to remember is when you issue a command with sudo you are not getting your shell environment unchanged. I never remember all the rules but they cover the details in the man page for sudo. Observe the difference when typing env versus sudo env in a terminal. That should help clarify some of your confusion.
            linux &amp;&amp; bash = &quot;the future&quot;

            Comment

            Working...
            X