Question

I downloaded Typesafe's Scala IDE bundle, and now I try to make it work with my project, which uses Scala 2.9.2 and Java 7. My problem is, Eclipse still compiles it with Java 6, and I get those nasty errors about javax.swing.JComboBox does not take type parametes.

I'm launching eclipse with JAVA_HOME pointing to my jdk7/jre directory, and I added JRE 7 libs to the project. What am I doing wrong?

EDIT: For some reason, it seems that only Scala compiler compiles with Java 6 - if I use plain .java file, it seems to be compiled with proper version. How could it be that Eclipse uses two different jdk's in one project?

Was it helpful?

Solution

The eclipse IDE is launched with whatever is the default JRE for your environment, like the one specified with the JAVA_HOME.

In this it's just like any other java application on your machine.

The jdk used to compile and run code within the ide is totally independent and it's defined within eclipse preferences under

Java > Installed JREs

You can add any runtime or sdk there and choose the default one used for new projects.

Additionally you can override this preference for each project within the project properties

In this way the compilation output is independent from your machine java environment, and can optionally be defined on a per-project basis.

As for the Scala-IDE, I need time because I don't have it installated on my day-job machine. I'll check later.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top