[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.newcomer] Re: Compiling for older version of java

Ed Merks wrote:
Joel,

I didn't think that Java 6.0 changed the class version levels again like Java 5.0 did. Java 5.0 changed the language significantly so there is additional information about generics that needs to be encoded in the .class files, but I didn't think Java 6.0 had any such impact. So my suspicion would be you are actually trying to run with a 1.4 JRE when you are getting the error you reported. You could try setting your language level to 1.4 to confirm that...


joel wrote:
Olivier Thomann wrote:

This means you didn't install a JRE 1.5, so the jre 1.6 is picked up instead of a 1.5 one.
I recommend that you add a JRE 1.5 in the Preferences>Java>Installed JREs

Ok, so what you are saying is that setting the 'Execution Environment' to J2SE-1.5(jre1.6.0_02) without actually having the JRE 1.5 installed will not work as I expected to? I was trying to avoid needlessly installing another version of the JRE.


--Joel

I may be missing something, so I apologize if that is the case. In my limited experience, (a) you shouldn't need to install the 1.5 JRE or JDK to compile with a lower compliance level; (b) if you compile with a compliance level that is too low for the classes being compiled, you do get compiler errors; and (c) you do need to compile with a lower compliance level to run on a lower level JRE.

I have a small test project that uses generics, so it requires 1.5. If I change the compiler compliance to 1.4, it doesn't compile. I have 1.6 on my Windows machine and 1.5 on my Linux machine. If I compile at the default 1.6 compliance level on Windows, it won't run on my Linux machine. If I recompile with 1.5 on Windows, it does run on the Linux machine. I did not need to install 1.5 on my Windows machine.

So I think that is how it is supposed to work. Why it is not working in this case I don't know. I have done this with Eclipse 3.3.0 but not with 3.3.1. Hope this helps. Mark