Categories

JAVA DATEBASE
Technology Network Community
Oracle Database
Fusion Middleware
Development Tools
Java
Desktop
Server & Storage Systems
Enterprise Management
Berkeley DB Family
Cloud Computing
Big Data
Business Intelligence
Architecture
Migration and Modernization
E-Business Suite
Siebel
PeopleSoft Enterprise
JD Edwards World
Industries
JD Edwards EnterpriseOne
User Productivity Kit Pro (UPK) and Tutor
Governance, Risk & Compliance (GRC)
Master Data Management (MDM)
Oracle CRM On Demand
On Demand: SaaS and Managed Applications
AutoVue Enterprise Visualization
Primavera
ATG
Agile PLM
Endeca Experience Management
Fusion Applications
Archived Forums

 



Tags

New To Java


parameterized types are only available if source level is 5.0


Hi,     I am using JDK 1.5. but wen i am trying to use parameterized arraylist( Arraylist<String>) it's throwing error "parameterized types are only available if source level is 5.0". Can anybody please help me out to resolve tis problem ?   Thanks and Regards,  Rana

You have an old version of Java. Either update to the current version or don't use generics.  [http://java.sun.com/j2se/1.5.0/docs/guide/language/generics.html]

I hereby predict that you're using Eclipse, and have the source level set to 1.4. Eclipse has it's own compiler, so it doesn't matter what JDK you think you're using, it'll still compile to whatever the compiler level is set to  In Eclipse, go to Windows->Preferences->Java->Compiler->Compiler compliance level and set it correctly

First the story: I know this item is 6 months old, but its very relevant to my issue.  My project was going along well and compiled and going through a debug cycle, debugging with Eclipse.  I thought some more changes would help, but those required level 5, so I changed prefs to level 5. That was yesterday, so now today I get a compile error of "Unsupported major.minor version 49.0".  I saw many "Unsupported 49.0" postings that say the the compiler is out of date, which seemed odd for my circumstance because it compiled well yesterday on the same machine.  Now for the question: If someone wants to use level 5 in Eclipse and gets the Unsupported 49.0 error when compiling, would the remedy be an Eclipse update or Java update.  And which update level?

The first thing I would try is setting the Eclipse compiler level (as described in the post before yours) and then completely rebuilding.

Hello. The post you describe refers to changing Eclipse compiler compliance level to 1.4.  This will compile if I revert my changes.  My question was how to keep compliance level at 5.0 and be able to use it, so I consider your post a non-answer.  So far I've updated Eclipse, installed JDK-6U11, J2SDK-1_4_2_13-NB5_0, and NetBeans 5.0.  I believe that is the full set of Eclipse/Java software and I still get "Unsupported major.minor vers ion 49.0" during compile.  I haven't used NetBeans before, and it appears to have a IDE similar to Eclipse.  I'll think of porting my source to a NetBeans project, but I don't understand why there is an option for compliance level 5.0 that won't let programs compile.

so I consider your post a non-answer.  Hust a tad rude eh what?  Blacklisted.

I was asking how to get compliance level 5 to work, and got a response "try 1.4". Although I am new to this forum, I thought the response had little to do with the question I asked.

...  Edited by: pbrockway2 on Jan 11, 2009 8:24 PM

pbrockway2: I was not my intention to be rude to you.  I just didn't think your answer was worth a duke dollar.  I've updated everything I have reinstalled Java and Eclipse.  It took a while to download everything. Code that was using compliance level 5 still has compilation errors, but I've reverted all to compliance level 1.4 or found alternatives. This doesn't get in my way much, but mainly just an annoyance of new features that don't work for me.

No problem.  The duke $ don't have any value - except as tokens, and in this case their value (ability to communicate) was negative...  The response I referred to didn't recommend 1.4.  Rather, it recomended to someone who was using 1.4 that they make their settings correct and explained how (but not what).  My response didn't have a lot of thought behind it.  It was simply what it said: if I were facing a new IDE that was misbehaving wrt existing code I would (a) check the settings  - indeed have a hunt through "Properties" to see what is available and (b) rebuild.  You most often see the "major.minor" version error as a runtime error rather than a compile time one.  Basically an old runtime is trying to use classes that were compiled using a new compiler and there are problems.  Remember that Eclipse itself is a Java application.  It has its own compiler but it is launched using whatever runtime you use to launch it.  If I were you - and if you have no pressing need for the ancient Java versions you refer to - I would remove them.  Java is 1.6 and NetBeans 6.something and Eclipse 3.4.  But if you do want multiple versions floating about at least make sure that you are launching Eclipse with a modern runtime.  From a command line "java -version" will report the version.  It can also be checked, within Eclipse, from "Help->About Eclipse SDK->Configuration details" (you are looking for -vm, near the top).  The version of java that is used is the first java executable mentioned on your OS's PATH - which is why you might check it with "java -version".  You can change the version that Eclipse will use by either changing the PATH, or by specifying the runtime when you start Eclipse with a "-vm" argument.  If you continue to have problems, reporting exact configuration details and error messages in as simple an example as you can manufacture, will help.  Also Eclipse does have on line help resources.

thanks. Y

My project was going along well and compiled and going through a debug cycle, debugging with Eclipse.  I thought some more changes would help, but those required level 5, so I changed prefs to level 5. That was yesterday, so now today I get a compile error of "Unsupported major.minor version 49.0".  So you're getting this error when running under Eclipse?  If yes, then it's because your build path references the old JRE version. Right-click on your project, select Build Path -> Configure Build Path, and switch to the "Libraries" tab. At the bottom you should see an entry "JRE System Library"  To change, you first need to install a later JDK/JRE.  Then, open "Preferences" from the "Window" menu, expand the "Java" entry, click on "Installed JREs", and add your new JRE to the list.  Then, go back to the Build Path, remove the existing JRE library, and add the new one with the "Add Library" button.

Zombie, locking.  db


Related Links

Pass a List as a command line option
can I catch an OutOfMemoryError
printf
Send formatted sms
Splitting class into multiple classes (simple fix I think)
Why we cannot override a method marked as static ?
Java EE Glassfish Tomcat 7.0
Question on getters and setters
Very quick question
Why go for a static inner class than a regular static class
why do I get this error?
why do I get this error?
Branching Statements
Need help on how to use HttpClient.
ArrayList Reference VS Object
accessing static field of class in a jar file