permaculture playing cards*
The moose likes Beginning Java and the fly likes error with latest jdk Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "error with latest jdk" Watch "error with latest jdk" New topic

error with latest jdk

mohamed mustaq

Joined: Dec 19, 2005
Posts: 21
i am using eclipse ide and i am using jdk1.5
if i try to run the program with arraylist method.
it throws a error.
this is my program
* Created on Jan 17, 2006
* TODO To change the template for this generated file go to
* Window - Preferences - Java - Code Style - Code Templates
package prac;
import java.util.*;

* @author mohamed mustaq
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class prac1 {

public static void main(String args[])
ArrayList<String> a=new ArrayList<String>();


public static void printAL(ArrayList<String> al){
for(String element :al){
System.out.print(element+" ");
System.out.println(" ");


and the error is
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
Syntax error on token "<", invalid AssignmentOperator
Syntax error on token "=", != expected
Syntax error on token "<", ( expected
Syntax error on token "(", invalid Expression
Syntax error, insert "}" to complete ClassBody

at prac.prac1.main(

may anyone help in this?
Vijay Kiran

Joined: Nov 18, 2004
Posts: 21
You need to change your project compliance settings in eclipse to 1.5.
Goto project -> Properties -> Java Compiler

Enable Project specific settings check box
Under JDK compliance select 5.0 in all the dropdown boxes.


Vijay<br />I blog, therefore I am<br /><a href="" target="_blank" rel="nofollow"></a>
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074

Also, note that you need to use Eclipse version 3.1 or newer if you want support for Java 1.5.

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Layne Lund
Ranch Hand

Joined: Dec 06, 2001
Posts: 3061
If the above suggestions don't help, please post the EXACT error message that you get. Otherwise, we will waste your time by just guessing the problem and a solution.


Java API Documentation
The Java Tutorial
I agree. Here's the link:
subject: error with latest jdk
Similar Threads
Having some trouble with this code.
Can the index number be specified in the ArrayList add method
The Programme is not Compiling
ArrayList Question
ArrayListMagnet- problem compiling