×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    Java version restrictions in ME?

    Hi all,

    I was hard at work on a project on NetBeans using the latest JDK from Nokia along with Java ME, when I attempted to implement the following method:

    Code:
    public static String deTokenize(String... input) { ... }
    To which Java complained with the error:

    Code:
    variable-arity methods are not supported in -source 1.3
    (use -source 5 or higher to enable variable-arity methods)
    I'm kind of desperate to get this functionality as it's already prevented me from implementing a few other methods - however I'm guessing that this restriction of java version is imposed by the use of ME and do not wish to mess any settings up if this is the case.

    If it is actually possible to use source 5 for Java ME, as it is requesting, I would like to know how to do so.

    Thanks in advance.

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

    Re: Java version restrictions in ME?

    No. CLDC is built around the Java 1.1 byte-code specification. And that restricts it to pre-5 source code. That means, no variable-length parameter lists, no generics, no for(each) loops, no auto-boxing, etc. As well as the byte-code format, there are also classes required to support some of these features, which are not present in the CLDC API.

    Luckily, *all* Java programmers used to make do with this.

    The main technique for variable-length parameter lists is:

    Code:
    public static String detokenize(String template, Object[] args) {
        // ...
    }
    
    
    s = detokenize("Page {1} of {2}", new Object[] { "1", "5" });
    A little more long-winded, but basically the same thing.

    Cheers,
    Graham.

  3. #3
    Registered User
    Join Date
    Mar 2009
    Posts
    10

    Re: Java version restrictions in ME?

    Thanks for that. How to create "temporary" arrays for parameter passing was going to be my next question.

Similar Threads

  1. SDK Installation problems (wrong drive) S60 3rd
    By Jeepy in forum Symbian Tools & SDKs
    Replies: 6
    Last Post: 2007-03-12, 21:59
  2. New name on MMS Java Library version 1.1?
    By torsrud in forum Mobile Java General
    Replies: 0
    Last Post: 2005-05-03, 16:14
  3. Symbian programs - Unable to run with higher version of JAVA
    By ja_calulot in forum Symbian Tools & SDKs
    Replies: 2
    Last Post: 2004-01-29, 15:38
  4. How develop Java games on mobile phones?
    By ericzutter in forum Mobile Java General
    Replies: 4
    Last Post: 2003-11-20, 23:14
  5. Replies: 0
    Last Post: 2003-10-12, 09:51

Posting Permissions

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