JAVA_HOME NOT SET WHEN INSTALL Storm

2019-09-06 06:28发布

问题:

I want to install Storm in my own machine(Ubuntu 12.04 LTS) and I follow the instructions in

    https://github.com/nathanmarz/storm/wiki/Installing-native-dependencies.

When I installing jzmq, I firstly successfully perform the command

    sudo ./autogen.sh

however, when I perform

    sudo ./configure

The configuration error:

    'configure: error: the JAVA_HOME environment variable must be set to your JDK location.' 

appears.

I have set the JAVA_HOME using

    sudo gedit /etc/profile
    export JAVA_HOME=/usr/lib/jvm/jdk1.6.0_35
    export JRE_HOME=.....
    export CLASSPATH=......
    source /etc/profile

and the output of

    echo $JAVA_HOME

is

    '/usr/lib/jvm/jdk1.6.0_35'.

I do not know why the error happens, anyone knows it? Thanks a lot.

回答1:

############################################################################### Here I give my way to solve the problem:

  1. Open configure in jzmq folder

    sudo gedit configure
    
  2. Find codes bellow:

    # Check for JDK
    if test "x$JAVA_HOME" = "x"; then
        as_fn_error $? "the JAVA_HOME environment variable must be set to your JDK location." "$LINENO" 5;
    fi
    
  3. set JAVA_HOME here:

    # Check for JDK
    export JAVA_HOME=/usr/lib/jdk1.6.0_35
    echo $JAVA_HOME
    if test "x$JAVA_HOME" = "x"; then
        as_fn_error $? "the JAVA_HOME environment variable must be set to your JDK location." "$LINENO" 5;
    fi
    
  4. This method can solve my problem, maybe it is useful for you.



回答2:

Hit the same issue among others while installing JZMQ as part of Storm 0.82 install a couple of months back. Solved this problem by doing exactly what you outlined above. There were some other gotchas for JZMQ. Copying my INSTALL steps and hopefully they'll be useful.

NOTE: OPENJDK 6 Required! 
- sudo apt-get install openjdk-6-jdk
- export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
- MUST READ: 
  - http://stackoverflow.com/questions/12115160/compiling-jzmq-on-ubuntu
  - https://github.com/nathanmarz/storm/wiki/Installing-native-dependencies
- wget https://github.com/nathanmarz/jzmq/archive/master.zip
- cd /usr/local/
  - sudo unzip jzmq-master.zip (OR master.zip)
  - cd jzmq-master
  - INSTALL:
    - Potentially Missing Pre-req:
      - libtool: sudo apt-get install libtool
      - autoconf: sudo apt-get install autoconf
      - (automake was already installed)
    - sudo ./autogen.sh
    - **Edit ./configure file to add "export JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64"**
    - sudo ./configure
    - cd src
    - sudo touch classdist_noinst.stamp
    - sudo CLASSPATH=.:./.:$CLASSPATH javac -d . org/zeromq/ZMQ.java org/zeromq/ZMQException.java org/zeromq/ZMQQueue.java org/zeromq/ZMQForwarder.java org/zeromq/ZMQStreamer.java
    - cd ..
    - sudo make
    - sudo make install