2

I installed WindowBuilder in Eclipse Oxygen.3a Release (4.7.3a) Build id: 20180405-1200 OS: Linux, v.4.15.0-20-generic, x86_64 / gtk 3.22.30 and getting an error:

Eclipse is running under 0, but
        this Java project has a 10 Java compliance level, so WindowBuilder will not be able to load classes
        from this project. Use a lower level of Java for the project, or run Eclipse using a newer Java
        version. 

However, when I try to change project compliance I get a message:

enter image description here

Is it save to install multiple versions of JRE in Kubuntu 18.04? I thought I am running already Eclipse with newest Java version because I read this in my Configuration:

java.runtime.version=10.0.1+10-Ubuntu-3ubuntu1
1

The error message you get suggests that you need to specify what JVM Eclipse should use. You can do this within the eclipse.ini file (see this website for more details). You need to include the path to the java 10 JVM within the eclipse.ini file, like this:

-vm
C:\jdk10\bin\javaw.exe

Change C:\jdk10\bin\javaw.exe to reflect your path to the java 10 JVM.

To answer your question:

It's perfectly safe to have multiple java versions installed. You can change the default java version by running sudo update-alternatives --config java. When you execute the java og javac command from the command line, it will use the version defined there. Eclipse can however be configured to use whatever version of java you want (as long as it's installed on your machine).

It seems like you already have Java 10. You can verify this by either running java -version, or get a list of all installed java environments by running sudo update-alternatives --list java. In Eclipse you can go to Window -> Preferences -> Java -> Compiler to see what java compilers are available to Eclipse, and add the one you need if it's not listed. If your desired java compiler version is available, you should be able to right click on the project within the project explorer, select Properties and then select the that version of the java compiler.

Hope this helps.

  • I have 10 installed, but I need 8. openjdk version "10.0.1" 2018-04-17 OpenJDK Runtime Environment (build 10.0.1+10-Ubuntu-3ubuntu1) OpenJDK 64-Bit Server VM (build 10.0.1+10-Ubuntu-3ubuntu1, mixed mode) – Hrvoje T May 15 '18 at 17:50
  • I have 10 installed, but I need 8. Is it possible to install older version? ` – Hrvoje T May 15 '18 at 17:51
  • 1
    @HrvojeT Yes, you can install java 8 (openJDK version) with: sudo apt-get install openjdk-8-jre, but java 10 should be able to compile any code written for the java 8 environment. – Boye Borg May 16 '18 at 7:52
  • If I have JDK10 I don't need JDK8? I can with 10 compile to run with JRE8 on WinXP? – Hrvoje T May 16 '18 at 19:47
  • @HrvojeT Yes, you can compile code to by compatible with JRE8 using JDK 10. However, this requires that you don't use any features introduced after java 8. This can be done by specifying the --release parameter, for example: javac --release 8 Foo.java. – Boye Borg May 18 '18 at 8:45

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.