如何在 ubuntu 中给出 java 路径

How to give java path in ubuntu

我在 ubuntu PC 上安装 mysql 数据库时遇到设置 java 路径的问题。该过程显示如下,我不知道如何设置 java 路径

Error: /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java not found or not a valid JDK
Type the full pathname of a JDK installation (or Ctrl-C to quit), the path will be stored in /home/devkrishna/.sqldeveloper/4.1.0/product.conf
/usr/lib/jvm/java-1.8.0-openjdk-amd64
Error: Java home /usr/lib/jvm/java-1.8.0-openjdk-amd64/bin/java is not a JDK.
Running SQL Developer under a JRE is not supported.

If this Java VM is actually a full JDK installation, add
'SetSkipJ2SDKCheck true' to one of the following files.
Otherwise specify a different Java JDK location with a
SetJavaHome directive in one of the following files:
/home/devkrishna/.sqldeveloper/4.1.0/product.conf
/opt/sqldeveloper/sqldeveloper/bin/sqldeveloper.conf

第一个错误看起来像您没有 openjdk-7 出于某种原因它看起来也在寻找 openjdk-8。安装至少其中之一:

sudo apt-get install openjdk-7-jdk

and/or

sudo apt-get install openjdk-8-jdk
  • 打开终端(Ctrl+Alt+t)
  • 类型

    sudo gedit .bashrc 
    
  • 输入 ubuntu 用户的密码
  • 转到文件的最后一行
  • 在新行中输入以下代码

    export JAVA_HOME=enter_java_path_here
    export PATH=$JAVA_HOME/bin:$PATH
    eg: export JAVA_HOME=/home/pranav/jdk1.8.0_131
        export PATH=$JAVA_HOME/bin:$PATH
    
  • 保存文件
  • 类型

    source ~/.bashrc
    

    在终端

  • 完成