jdk 1.5 on linux  
Author Message
mbaroukh





PostPosted: 2004-5-30 18:12:00 Top

java-programmer, jdk 1.5 on linux Hi.

Anybody tried jdk 1.5 on linux ?

I downloaded it, but I can't use any of new features.
Example : Generics

import java.util.*;
class test {
List<String> list = new ArrayList<String>();
}

this class compile fine on jdk 1.5 on Windows, but make on error on
linux :

> ./java -version
java version "1.5.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-beta-b32c)
Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

> ./javac test.java
test.java:4: <identifier> expected
List<String> list = new ArrayList<String>();
^
1 error


on windows, java -version returns
C:\Documents and Settings\Mike>java -version
java version "1.5.0-beta2"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0-beta2-b51)
Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode,
sharing)


I downloaded the 2 version (windows & linux) together.
Sun says that linux version is also a beta2 version but that's not
what "java -version" report.

So, anybody having the same problem or an idea on what happened ?

Thansk in advance.

Mike
 
Chris Uppal





PostPosted: 2004-5-30 18:44:00 Top

java-programmer >> jdk 1.5 on linux Mike Baroukh wrote:

> > ./javac test.java
> test.java:4: <identifier> expected
> List<String> list = new ArrayList<String>();

You need to tell javac that you are using the new syntax:

javac -source 1.5 test.java

The same is true on Windows.

-- chris


 
Larry Barowski





PostPosted: 2004-5-30 19:14:00 Top

java-programmer >> jdk 1.5 on linux
"Mike Baroukh" <email***@***.com> wrote in message
news:email***@***.com...
> Hi.
>
> Anybody tried jdk 1.5 on linux ?
>
> I downloaded it, but I can't use any of new features.
> Example : Generics
>
> import java.util.*;
> class test {
> List<String> list = new ArrayList<String>();
> }
>
> this class compile fine on jdk 1.5 on Windows, but make on error on
> linux :
>
> > ./java -version
> java version "1.5.0-beta"
> Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.5.0-beta-b32c)
> Java HotSpot(TM) Client VM (build 1.5.0-beta-b32c, mixed mode)

Is 1.5.0 beta 1 still on your PATH? Make sure you are running the
beta 2 that you downloaded. In beta 1, -source 1.5 arguments were
needed to compile code with generics, but in beta 2 this is only
necessary if you are using enum and/or assert.



 
 
Chris Uppal





PostPosted: 2004-5-30 20:29:00 Top

java-programmer >> jdk 1.5 on linux Larry Barowski wrote:

> In beta 1, -source 1.5 arguments were
> needed to compile code with generics, but in beta 2 this is only
> necessary if you are using enum and/or assert.

Thanks, I hadn't realised beta2 was out.

-- chris