jdk 1.5 on linux

M

Mike Baroukh

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
 
C

Chris Uppal

Mike said:
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
 
L

Larry Barowski

Mike Baroukh said:
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 "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.
 
C

Chris Uppal

Larry said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top