Eclipse 和 Java-9

Eclipse 和 Java-9

Java-9 本周发布,我立即安装了它。现在我想安装 eclipse,但在构建其依赖项时,安装程​​序要安装 java-7,这显然行不通。

有人能帮我解决这个问题吗?我正在使用带有 KDE neon 窗口管理器的 Ubuntu 16.04。谢谢

答案1

现在让我们使用这个方法:

  1. 安装java 8(我猜 eclipse 会接受):

    sudo apt-get install oracle-java8-installer
    
    • 检查并确保你的默认设置java 9仍然是老板:

      sudo update-alternatives --config java
      
    • 若不需要,请根据需要通过选择上一步中的数字进行修改:

      There are 5 choices for the alternative java (providing /usr/bin/java).
      
      Selection    Path                                            Priority   Status
      ------------------------------------------------------------
         0            /usr/lib/jvm/java-9-oracle/bin/java              1091      auto mode
         1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
         2            /usr/lib/jvm/java-8-oracle/jre/bin/java          1081      manual mode
       * 3            /usr/lib/jvm/java-9-oracle/bin/java              1091      manual mode
         4            /usr/lib/jvm/jdk1.8.0_91                         100       manual mode
         5            /usr/lib/jvm/jdk1.8.0_91/bin/java                100       manual mode
      
      Press <enter> to keep the current choice[*], or type selection number: 
      
  2. 现在运行sudo update-alternatives --display java你应该会看到这个:

    java - manual mode
      link best version is /usr/lib/jvm/java-9-oracle/bin/java
      link currently points to /usr/lib/jvm/java-9-oracle/bin/java
      link java is /usr/bin/java
      slave java.1.gz is /usr/share/man/man1/java.1.gz
    /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java - priority 1081
       slave java.1.gz: /usr/lib/jvm/java-8-openjdk-amd64/jre/man/man1/java.1.gz
    /usr/lib/jvm/java-8-oracle/jre/bin/java - priority 1081
      slave java.1.gz: /usr/lib/jvm/java-8-oracle/man/man1/java.1.gz
    /usr/lib/jvm/java-9-oracle/bin/java - priority 1091
    /usr/lib/jvm/jdk1.8.0_91 - priority 100
    /usr/lib/jvm/jdk1.8.0_91/bin/java - priority 100
    
    • 正如你所看到的,我使用它java 9作为我的默认设置,但我还java 8安装了将路径复制到 java 8即:/usr/lib/jvm/jdk1.8.0_91/bin/java
  3. 现在在您的 eclise 文件夹中打开eclipse.ini文件并将以下行添加到最顶部:

    -vm
    /usr/lib/jvm/jdk1.8.0_91/bin/java
    
    • 我的 eclipse.ini 文件:

       -vm
       /usr/lib/jvm/jdk1.8.0_91/bin/java
       -startup
       plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar
       --launcher.library
       plugins/org.eclipse.equinox.launcher.gtk.linux.x86_64_1.1.300.v20150602-1417   
       -product
       org.eclipse.epp.package.java.product
       --launcher.defaultAction
       openFile
       -showsplash
       org.eclipse.platform
       --launcher.XXMaxPermSize
       256m
       --launcher.defaultAction
       openFile
       --launcher.appendVmargs
       -vmargs
       -Dosgi.requiredJavaVersion=1.7
       -XX:MaxPermSize=256m
       -Xms256m
       -Xmx1024m
      
  4. 现在启动你的 eclipse,它将使用java vmeclipse.ini 文件中给出的内容。

相关内容