Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

sdk 1.5 beta

 
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,
I got a problem with sdk 1.5; in my data structures book it says we can use (sdk 1.5) collections in a generic way such as:

LinkedList<Integer> intList = new LinkedList<Integer>();

I work with eclipse 3.0 and have sdk 1.5 beta installed, but when I type the code above, I'm not able to compile. the error msg is "syntax error on token "<" invalid AssignmentOperator"
Am I missing something obvious here?
Any help is greatly appreciated!
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eclipse does not (yet) support the new 1.5 syntax.
There is an experimental plugin for Eclipse 3 that's supposed to give at least partial support, you'll need to search the Eclipse site for it.
 
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the IDEs and Other Tools forum...
 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Jeroen,
in this case it should work when i use command line to compile and execute my files, but somehow it gives me the same error message when i try to compile it via cmd. any more ideas??
help is greatly appreciated.

Ben
 
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,
When you use the command line, does it recognize that you are using the 1.5 version of Java?

To check:
>java -version
 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yupp, it does:

java -version

output:
java version "1.5.0-beta2"
 
Jeanne Boyarsky
author & internet detective
Posts: 40239
819
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ben,
Since it happens at the command line too, I'm going to move it to Java in General.
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you using javac -source 1.5 ?
 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, after trying to get it to work, I removed the 1.4 version, so there is only one vm on my computer. I would think I dont have to specify the source, do I?
thanks,
ben
 
author
Posts: 799
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You do have to specify the source level. By default, the 1.5 Java compiler does not recognize the new features in Tiger.

-Jeff-
 
Ben Buchli
Ranch Hand
Posts: 83
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What?? doesnt seem to be a tiger then... rather a pussycat!!
 
Ranch Hand
Posts: 1365
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was the same way for Java 1.4. Since there's code which is legal only with -source 1.3 and code which is legal only with -source 1.4 the people at Sun decided not to break legacy build configurations by causing the default setting to break on older code. It's easier for developers to simply adopt new habits with new versions and let old versions continue to function unaware of the differences. If it weren't for the new keywords (assert in 1.4, enum + foreach and whatever else in 1.5) this wouldn't be a problem, but alas it is.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the new keywords (assert in 1.4, enum + foreach and whatever else in 1.5)

It's just enum for 1.5. There's no foreach keyword - there's just a new syntax using "for". Still, enum is enough reason for them to be careful about backwards compatibility, since I've seen people write things like
 
Ranch Hand
Posts: 8943
Firefox Browser Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any issues if I install JDK 1.5 in a windows machine where JDK 1.4 already installed.

Java Tiger will named as Java 5 rather than j2se 1.5.

http://www.theserverside.com/news/thread.tss?thread_id=26955
 
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Originally posted by Pradeep Bhat:
Are there any issues if I install JDK 1.5 in a windows machine where JDK 1.4 already installed.

Java Tiger will named as Java 5 rather than j2se 1.5.

http://www.theserverside.com/news/thread.tss?thread_id=26955



Well, but it doesn't make sense... But it seems to reflect that there is a revolution in Java...
 
Without deviation from the norm, progress is not possible - Zappa. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic