×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2009
    Posts
    35

    for-each loops are not supported in -source 1.3

    Hi,

    I'm trying to compile my application, i'm getting the following errors -

    - for-each loops are not supported in -source 1.3
    (try -source 1.5 to enable for-each loops)
    for (Method method : methodArray) {

    -generics are not supported in -source 1.3
    (try -source 1.5 to enable generics)
    List<Method> methodList = new ArrayList<Method>();


    I have jdk1.5 installed in my system.

    Any help on this?

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: for-each loops are not supported in -source 1.3

    Yes, I'm afraid your compiler is correct.

    CLDC is based on Java 1.1, and is not compatible with .class files generated by later compilers, unless you compile with "-target 1.1". Unfortunately, to use "-target 1.1", you need to use "-source 1.2", which disables newer features of the Java language. In particular, generics, for-each loops and enumerations are not available to you, because they are all Java 5 features.

    Also, from looking at your code, I should mention that the classes ArrayList and Method do not exist in the MIDP API.

    To iterate through a collection (like a Vector), you should use an Enumeration.

    Graham.

Similar Threads

  1. [help] complex problem (loops)
    By AJ____92 in forum Symbian
    Replies: 11
    Last Post: 2010-01-04, 19:06
  2. how to display images in loops contionously with some sort of delay
    By narendrachinni in forum Symbian User Interface
    Replies: 3
    Last Post: 2009-09-01, 11:20
  3. player.setLoopCount(-1) loops only with break in N95
    By karstenSpr in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2008-04-08, 14:15
  4. Re: Timer or Timed loops ?
    By scc in forum Symbian
    Replies: 21
    Last Post: 2008-03-17, 16:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×