You need to enable JavaScript to run this app.
最新活动
大模型
产品
解决方案
定价
生态与合作
支持与服务
开发者
了解我们

安装OpenDaylight控制器遇JAVA_HOME相关错误求助

Fixing OpenDaylight Beryllium Karaf Startup Errors

Alright, let's tackle this OpenDaylight installation issue you're facing—those errors are all pointing to two key problems: an incompatible Java version and missing JAVA_HOME configuration. Here's how to fix them step by step:

1. Use Java 8 (Mandatory for Beryllium)

OpenDaylight 0.4.0-Beryllium only supports Java 8—your current setup uses Java 11, which removed critical features that this older Karaf version relies on (like MaxPermSize, UnsyncloadClass, and the endorsed directories mechanism).

To install and switch to Java 8:

  • Install OpenJDK 8 via apt:
    sudo apt update
    sudo apt install openjdk-8-jdk
    
  • Set Java 8 as your default version:
    sudo update-alternatives --config java
    sudo update-alternatives --config javac
    
    When prompted, select the option corresponding to openjdk-8-jdk.
  • Verify the change:
    java -version
    
    You should see output like openjdk version "1.8.0_XXX".

2. Set Up JAVA_HOME Environment Variable

The error mentions JAVA_HOME not set—Karaf needs this to locate your Java installation reliably.

  • First, find your Java 8 installation path (usually /usr/lib/jvm/java-8-openjdk-amd64):
    update-alternatives --list java
    
  • Edit your bash profile to set the variable:
    nano ~/.bashrc
    
  • Add these lines at the end of the file:
    export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
    export PATH=$JAVA_HOME/bin:$PATH
    
    Replace the path with the one you found if it's different.
  • Save and exit, then refresh your environment:
    source ~/.bashrc
    
  • Verify the setup:
    echo $JAVA_HOME
    
    It should output the path you just set.

3. Restart Karaf

Now run the Karaf startup command again:

sudo ./distribution-karaf-0.4.0-Beryllium/bin/karaf

This should resolve all the Java-related errors you saw earlier.

Quick Breakdown of Your Original Errors

  • JAVA_HOME not set; results may vary: Karaf couldn't find a consistent Java environment, leading to unpredictable behavior.
  • Java 11 warnings/errors: Java 11 removed support for legacy flags and mechanisms that Beryllium's Karaf build uses—downgrading to Java 8 eliminates these issues entirely.

内容的提问来源于stack exchange,提问作者Its ME

火山引擎 最新活动