3

I have just installed WindowBuilder for Eclipse and java 1.7 JDK, but when I create a new JFrame in Eclipse, and try to open the "design-view" in WindowBuilder I get the following error: "Eclipse is running under 1.6, but the Java project has a 1.7 Java compliance level, so WindowBuilder will not be able to load classes from the project. Use a lower level of Java for the project, or run Eclipse using a newer Java version."

When I check the properties for the project, it is set to Java Compiler 1.7. When I run a Java -version in my terminal I get:

  java version "1.7.0_15"
  Java(TM) SE Runtime Environment (build 1.7.0_15-b03)
  Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

I have tried to chance the path to the newest Java, following this link: Link to Eclipse Wiki

When changing it to:

-vm
/Library/Java/JavaVirtualMachines/jdk1.7.0_15.jdk/Contents/Home/bin/java

I get a error when I try to open Eclipse saying: "the jvm shared library does not contain the jni_createjavavm symbol"

What's where I am stuck. Anyone how knows how to fix this problem? I have tried using Netbeans, but my Mac and Netbeans are not best friends: Pic of screen-crash

  • change the project compliance level to 1.6 from Project Properties and leave the Eclipse running under 1.6 – niculare Mar 02 '13 at 11:01
  • Jesus. Thanks, that made it. Will I still be able to open, let's say, java files, made in NetBeans written with java 1.7? And compile them and so on? – Kasper Sørensen Mar 03 '13 at 11:11
  • If you use some specific features of Java 1.7 which are not available in Java 1.6, it will give you a compile error. Otherwise, everything should be OK. – niculare Mar 03 '13 at 11:15
  • Okay. Thank you very much! Used tried to open a projekt made in Netbeans, in Eclipse and unfortunately that was not a succes. Got quite a lot of errors. Maybe I just have to juse Netbeans - it just does not seem as solid and "light" as Eclipse. – Kasper Sørensen Mar 03 '13 at 11:38
  • You cannot open in Eclipse a project created in Netbeans. But you can create a new Eclipse project using the source files written in Netbeans. – niculare Mar 03 '13 at 11:40
  • Yep - that was what I tried. When doing that, and opening the file with WindowBuilder, I get a lot of errors and it is not possible to view end edit the GUI in WindowBuilder - but maybe that's just not possible? (I'm quite new to this) – Kasper Sørensen Mar 03 '13 at 11:47
  • It is not possible to edit the GUI in WindowBuilder if the code has compile errors. Try to fix the errors and then open the GUI editor. AFAIK WindowBuilder should be able to parse the code generated by other GUI builders or written by hand. – niculare Mar 03 '13 at 11:56
  • That makes sense. I'll see if I can get it to work. Thank you very much for the answers! – Kasper Sørensen Mar 03 '13 at 12:27
  • you're welcome. I'll post the answer from comments as an "official" answer and please accept it:). Thanks. – niculare Mar 03 '13 at 12:29
  • Done :) Just tried to build a small GUI in netbeans, and even though it is possible to build and works fine there, I can't open it in WindowBuilder. The errors are all about the design of the GUI. Like this: `layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)` will create: "org.jdesktop.GroupLayout cannot be resolved to a type" Do you know how to fix this? – Kasper Sørensen Mar 03 '13 at 13:07
  • take a look [here](http://stackoverflow.com/questions/10882118/eclipse-does-not-recognize-org-jdesktop) – niculare Mar 03 '13 at 13:14

2 Answers2

6

Go to Project Properties and change the project compliance level from 1.7 to 1.6. Also leave the Eclipse running under Java 1.6.

niculare
  • 3,629
  • 1
  • 25
  • 39
  • The one not so good thing about this, is that I'm not able to make a TreeMap like: `... = new TreeMap<>();` And other things that are only able to make with Java 1.7 :/ – Kasper Sørensen Mar 05 '13 at 23:41
  • 1
    If you must have the facilities of Java 1.7, change both the compliance level of the project and the Java version under which Eclipse is running to 1.7. – niculare Mar 06 '13 at 06:28
  • I already did that. Everything is now set to 1.7, but when I go to `Eclipse -> About Eclipse -> Installation Details -> Configuration` the Java-version shows 1.6.0_43 – Kasper Sørensen Mar 06 '13 at 09:27
  • I have the same problem with the message `Eclipse is running under 0, but this Java project has a 1.8 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. ` Tried to change project compliance but no luck – Hrvoje T May 15 '18 at 11:59
-1

In my case I Change my default java version in my whole OS, I followed the steps in this question!, I am using Debian but you can look for you OS how to make java 1.7 the default java version, in my case I do not need java 1.6 anymore and I set my OS java default version from 1.6 to 1.7 it made eclipse load under my default java version 1.7 and then I changed in Eclipse to all workspace the java to version 1.7.

By doing this eclipse will run with default java version 1.7 of the OS.

But if you still need java 1.6 for the OS and 1.7 just for eclipse, in my case using Debian you need to edit:

vim /etc/eclipse.ini

And following suggestion adding the option "-vm /usr/lib/jvm/java-7-openjdk-amd64/bin/"

Of course you need to know your java 1.7 path, it is an example using my path.

It's up to you to choose any solution by OS to load eclipse from he java version of the OS or changing the eclipse.ini to java 1.7 and leaving java 1.6 as default for OS.

Community
  • 1
  • 1