Re: java 1.5 on 1.4.2
- From: Ross Bamford <ross@xxxxxxxxxxxx>
- Date: Fri, 29 Apr 2005 02:23:08 +0100
On Fri, 2005-04-29 at 03:00 +0200, Gerbrand van Dieijen wrote:
> oracle schreef:
> > Just need to verify something.
> >
> > You can not use a java 1.5 war file on a machine with java 1.4.2 loaded
> > on it.
> >
>
> That depends, you can compile Java 1.5 source code to a 1.4 class file.
> Then it will run fine on a java 1.4.2 JVM, even with the use of
> generics, and other java 1.5 extensions.
Hmm, I'd like a copy of your JVM... You can specify to javac the Source
Code and Target JVM versions you require. Specifying a lower Target
requires also that you set a lower Source.
So you can compile, for example, for 1.4, using:
javac -source 1.4 -target 1.4 MyClass.java
However, if MyClass.java uses *any* JDK 1.5 specific features (Generics,
For-each loop, etc), you'll get:
MyClass.java:5: generics are not supported in -source 1.4
(try -source 1.5 to enable generics)
static Vector<MyClass> v = new Vector<MyClass>();
^
1 error
(as already mentioned, the -source argument is mandatory in this case,
although I'm not sure if it implies the target).
Ross
--
[Ross A. Bamford] [ross AT the.website.domain]
Roscopeco Open Tech ++ Open Source + Java + Apache + CMF
http://www.roscopec0.f9.co.uk/ + info@xxxxxxxxxxxxxxxxxx
.
- Follow-Ups:
- Re: java 1.5 on 1.4.2
- From: Tor Iver Wilhelmsen
- Re: java 1.5 on 1.4.2
- References:
- java 1.5 on 1.4.2
- From: oracle
- Re: java 1.5 on 1.4.2
- From: Gerbrand van Dieijen
- java 1.5 on 1.4.2
- Prev by Date: Re: tomcat error 500...
- Next by Date: Re: Run a Java packaged inside a Jar
- Previous by thread: Re: java 1.5 on 1.4.2
- Next by thread: Re: java 1.5 on 1.4.2
- Index(es):
Relevant Pages
|
|