J2SDK 1.5B1 compiling issues...

A

Alan

I installed the 1.5B1 SDK on Win2000 and cannot compile code that
contains new language features. What could I possibly be doing wrong?
Am I missing a new compiler directive to enable new language features?


javac -version returns:
javac 1.5.0-beta

This is the code:

import java.util.ArrayList;
public class Generics
{
public static void main(String[] args)
{
ArrayList<Integer> list = new ArrayList<Integer>();
}
}

error:

Generics.java:6: '(' or '[' expected
ArrayList<Integer> list = new ArrayList<Integer>();
^

I also can't compile with the new 'for loop' construct.


Thanks,


Alan.
 
J

Juergen Kreileder

Alan said:
I installed the 1.5B1 SDK on Win2000 and cannot compile code that
contains new language features. What could I possibly be doing
wrong? Am I missing a new compiler directive to enable new language
features?

Yes, you have to use "javac -source 1.5 ...".


Juergen
 
A

Alan

Doh! Thanks...
I don't know why I missed that one in the docs. I suppose I thought it
would be the default.

Take care!

Alan.
 

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,744
Messages
2,569,484
Members
44,905
Latest member
Kristy_Poole

Latest Threads

Top