generics not supported in -source 1.3 ?

westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
Hi, being a newbie to Ice, when i run the ant command for the IceEJ demoproject "hello" i receive this output:
What shall i do?
C:\IceEJ-1.1.0\demo\IceE\midp\hello>ant
Buildfile: build.xml

config-init:

init:

generate:
    [mkdir] Created dir: C:\IceEJ-1.1.0\demo\IceE\midp\hello\generated
[slice2javae] C:\Ice-3.2.0\bin\slice2javae  --output-dir C:\IceEJ-1.1.0\demo\Ice
E\midp\hello\generated C:\IceEJ-1.1.0\demo\IceE\jdk\hello\Hello.ice

compile:
    [mkdir] Created dir: C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
    [javac] Compiling 8 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
    [javac] Compiling 4 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
    
    [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDel.java:16: generics
 are not supported in -source 1.3
    [javac] (use -source 5 or higher to enable generics)
    [javac]     void sayHello(java.util.Map<String, String> __ctx)
    [javac]                                ^
    [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDelD.java:17: generic
s are not supported in -source 1.3
    [javac] (use -source 5 or higher to enable generics)
    [javac]     sayHello(java.util.Map<String, String> __ctx)
    [javac]                           ^
    [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDelM.java:17: generic
s are not supported in -source 1.3
    [javac] (use -source 5 or higher to enable generics)
    [javac]     sayHello(java.util.Map<String, String> __ctx)
    [javac]                           ^
    [javac] 3 errors

BUILD FAILED
C:\IceEJ-1.1.0\demo\IceE\midp\hello\build.xml:35: Compile failed; see the compiler error output for details.

Comments

  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    Hi,

    Java generics are only supported with the JDK >= 1.5.

    Cheers,
    Benoit.
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    benoit wrote: »
    Hi,

    Java generics are only supported with the JDK >= 1.5.

    Cheers,
    Benoit.
    Ok, well i run Java SDK 1.6, guess it may have to do with this extract from the ant-buildfile:
    <target name="compile" depends="generate">
            <mkdir dir="${class.dir}"/>
    	<javac srcdir="${generated.dir}" destdir ="${class.dir}" source="1.3" debug="${debug}"
    	    bootclasspathref="midp.bootclasspath" classpathref="midp.classpath"/>
            <javac srcdir="." destdir="${class.dir}" source="1.3" excludes="generated/**" debug="${debug}"
    	    bootclasspathref="midp.bootclasspath">
                <classpath>
    	       <path refid="midp.classpath"/>
    	       <pathelement path="classes"/>
    	    </classpath>
            </javac>
        </target>
    
    However, when i change to source=1.6 i receive 21 errors instead of 3 :) I guess i need a tutorial.pdf for IceEJ very much the same as the pdf for ice-3.2.0 ..... Any other suggestions on what i can change? Its the demo-project in iceEJ, it should compile no problem.
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    Please note that you are trying to build the MIDP demos while using generics. The MIDP demos are only supported on CLDC 1.1 + MIDP 2.0 platforms which do not support generics (see the Sun website for details) So basically it's a "don't do that" kind of situation.

    The source attribute in the javac targets are to catch CLDC compatibility issues at compile time. You can alter the ant build file but the code won't likely pass the preverification step or run in an JME environment.

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    well, here is the output when running the build.xml with version=1.6 :
    C:\IceEJ-1.1.0\demo\IceE\midp\hello>ant
    Buildfile: build.xml
    config-init:
    init:
    generate:
    [slice2javae] skipping Hello.ice
    
    compile:
        [javac] Compiling 4 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDel.java:16: cannot find symbol
        [javac] symbol  : class Map
        [javac] location: package java.util
        [javac]     void sayHello(java.util.Map<String, String> __ctx)
        [javac]                            ^
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDelM.java:26: cannot find symbol
        [javac] symbol  : method is()
        [javac] location: class IceInternal.Outgoing
        [javac]                 IceInternal.BasicStream __is = __og.is();
        [javac]                                                    ^
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\Demo\_HelloDelM.java:60: cannot find symbol
        [javac] symbol  : method is()
        [javac] location: class IceInternal.Outgoing
        [javac]                 IceInternal.BasicStream __is = __og.is();
        [javac]                                                    ^
        [javac] 3 errors
    
    Has anyone else experienced this? thnx for your replies
  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    [slice2javae] C:\Ice-3.2.0\bin\slice2javae --output-dir C:\IceEJ-1.1.0\demo\Ice

    Where did you get this slice2javae translator? The slice2javae translator isn't included with Ice-3.2.0.

    You should use the slice2javae translator from the Ice-E download page

    Cheers
    Benoit.
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    benoit wrote: »
    Where did you get this slice2javae translator? The slice2javae translator isn't included with Ice-3.2.0.
    You should use the slice2javae translator from the Ice-E download page
    Cheers
    Benoit.
    Thanks guys for your patience with a newbie. Well, i copied the slice2javae from IceEJ-1.1.0 to Ice-3.2.0 ....

    What i want to learn is how to include Ice communication protocol in a midp program. It shall run on a Nokia E70. I've made a midp program that communicates through socket, and now i want to use Ice instead. Is there any tutorials on how to compile and run java midp & Ice? Any hint much appreciated.

    As beagles wrote: "Please note that you are trying to build the MIDP demos while using generics. The MIDP demos are only supported on CLDC 1.1 + MIDP 2.0 platforms which do not support generics".. I guess the hello demo cant be compiled since I dont have enough knowledge on what to change.. Well, thanks guys anyway .. ;)
  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    The slice2javae binary isn't included in the IceEJ-1.1.0 (.zip or .tar.gz) package. Did you mean the IceE-trans-1.1.0-bin-win.zip package?

    Or did you by any chance compile slice2javae from the IceE-trans-1.1.0 source package? If yes, did you build it with the static or DLL configuration?

    If you built it with the DLL configuration, I suspect you're not using the Slice DLL built with the translator sources but instead use the one from Ice-3.2.0. You should build the translator with the static configuration to make sure it doesn't conflict with DLLs from Ice-3.2.0. See the INSTALL.WINDOWS file from IceE-trans-1.1.0 for more information on how to build slice2javae with the static configuration.

    Cheers,
    Benoit.
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    benoit wrote: »
    The slice2javae binary isn't included in the IceEJ-1.1.0 (.zip or .tar.gz) package. Did you mean the IceE-trans-1.1.0-bin-win.zip package?
    Well, it must have been from the IceE-trans-1.1.0-bin-win.zip package.
    I have not (intentionally..) compiled it the way you described it. However, its no big deal that i cant compile the demo "hello", what i want is to be able to compile any midp packages with an ant-build-file. So in a way, i am looking for a tutorial on building ice apps for mobile devices. Mobile devices will be a big thing, in my opinion ... ;)
  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    Sorry, I don't understand what you're trying to do... you say you don't want to compile the "hello" demo but want to compile an MIDP application. I'm afraid if you can't even compile the "hello" demo you won't go very far into compiling another MIDP application...

    The MIDP "hello" demo should compile and you need to sort out why it doesn't compile before trying to compile anything else. For some reasons your slice2javae is generating code with Java5 generics where it shouldn't, that's wrong. So you first need to figure out what's wrong with your slice2javae translator.

    What does the command "slice2javae -version" say? Can you move the slice2javae translator out of the C:\Ice-3.2.0\bin directory and remove C:\Ice-3.2.0\bin from your PATH to make sure you're not using any conflicting Ice 3.2.0 DLL?

    Cheers,
    Benoit.
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    benoit wrote: »
    ...What does the command "slice2javae -version" say? Can you move the slice2javae translator out of the C:\Ice-3.2.0\bin directory and remove C:\Ice-3.2.0\bin from your PATH to make sure you're not using any conflicting Ice 3.2.0 DLL?Cheers,Benoit.

    The "slice2javae --version" says its version 1.1.0
    It's the version from this zip-file: IceE-trans-1.1.0-bin-win.zip

    I have removed the slice2javae out of directory C:\Ice-3.2.0\bin.
    It's now in C:\IceEJ-1.1.0\bin.

    I have removed C:\Ice-3.2.0\bin from the PATH, and added C:\IceEJ-1.1.0\bin to the PATH and restarted the pc.

    I unzipped the file "IceEJ-1.1.0.zip" again and placed it in C:\ root, to have a clean version.

    When i run the ant file, heres the output:
    Buildfile: build.xml
    config-init:
    init:
    generate:
    [slice2javae] C:\Ice-3.2.0\bin\slice2javae  --output-dir C:\IceEJ-1.1.0\demo\IceE\midp\hello\generated C:\IceEJ-1.1.0\demo\IceE\jdk\hello\Hello.ice
    
    BUILD FAILED
    C:\IceEJ-1.1.0\demo\IceE\midp\hello\build.xml:25: Execute failed: java.io.IOExce
    ption: Cannot run program "C:\Ice-3.2.0\bin\slice2javae": CreateProcess error=2,
     File is not found (Det gÕr inte att hitta filen)
    

    I dont understand why ant or the build-file is looking for the slicer in the C:\ice-3.2.0\bin folder. Thanks benoit for your sincere support.

    Here is info on which java sdk i run:
    C:\IceEJ-1.1.0\demo\IceE\midp\hello>java -version
    java version "1.6.0_01"
    Java(TM) SE Runtime Environment (build 1.6.0_01-b06)
    Java HotSpot(TM) Client VM (build 1.6.0_01-b06, mixed mode, sharing)
    
  • benoitbenoit Rennes, FranceBenoit FoucherOrganization: ZeroC, Inc.Project: IceAdministrators, ZeroC Staff ZeroC Staff
    Hi,

    It's most likely looking into the C:\Ice-3.2.0 folder because you have the ICE_HOME environment variable set. Can you unset this environment variable and try again? The slice2javae executable will need to be in your PATH.

    Cheers,
    Benoit.
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    I've removed the ICE_HOME environment variable.

    Now when i use ant to build the solution, it misses the path to J2ME edition:
    compile:
        [javac] Compiling 2 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\clas
    ses
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\ClientMIDlet.java:13: package ja
    vax.microedition.midlet does not exist
        [javac]     extends javax.microedition.midlet.MIDlet
        [javac]                                      ^
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\ClientMIDlet.java:14: package ja
    vax.microedition.lcdui does not exist
        [javac]     implements javax.microedition.lcdui.CommandListener
        [javac]                                        ^
        [javac] C:\IceEJ-1.1.0\demo\IceE\midp\hello\ClientMIDlet.java:88: package javax.microedition.lcdui does not exist ....
    

    There was a total of 37 faults, all about "missing package javax.microedition..."

    I've compiled standard midlets before (with eclipse and nokia toolkit), i know i have microedition on the pc. Is it a path variable i need to set?
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    You need to configure the CLDCLIB and MIDPLIB properties found in IceEJ-1.1.0/config/build.properties. There are two properties because the Sun WTK has the CLDC and MIDP classes in separate jar files. However, the Nokia toolkit you are using may include all of the required classes in a single library.If that is the case, I think you can get away with setting either property to point to the proper file.

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    I have configured the CLDCLIB and MIDPLIB properties found in IceEJ-1.1.0/config/build.properties, and finally (...) it works when i compile it with ant and the build.xml file! Thanks for your support :o
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    Only the Helloserver.jar is being built

    Hi!

    When i looked into what is being compiled/ generated by the build.xml in the
    \IceEJ-1.1.0\demo\IceE\midp\hello example, only the Hellowerver.jar is being built.

    Here is a line in build.xml:
    <target name="client-jar" depends="compile" if="midp">

    1. When is "midp" true/supported?

    I have tried removing the if-cases, having the *.jad + *.jar being built, but that did not produce a functioning midp application.

    I first did a "ant clean" command to make the *.jad and *.jar go away. With "ant all" / "ant" it does only compile/ produce the Helloserver.jar

    thanks for help ;)
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    The fact that the server jar is compiling in this case is actually a bug. Thanks for pointing it out!

    'midp' is defined either by editing the IceEJ-1.1.0/config/build.properties and uncommenting the "midp = on" line or defining midp on the command line. e.g.:

    ant -Dmidp=on

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    client-preverify fails

    I set the midp = on in the config/build.properties

    also made both *.jad and *.jar be created in a tmp folder.
    (edited the build.xml)

    now when comiling, the *.jad and *.jar is created.
    This is errormessage though:
    client-obfuscate:
    
    client-preverify:
         [exec] JAR file creation failed with error -1
         [exec] The preverified classes if any are in tmp15025. See jar log of error
    s in .\jarlog.txt
         [exec] Result: 1
    

    jarlog.txt:
    Error: Invalid argument
    jar -cfm "./HelloServer.jar" tmp15029\\META-INF\MANIFEST.MF -C tmp15029 . 
    

    Where can I go from here? I have tried setting hasProguardAndMIDP = on in the build.properties which gives me the following message:
    client-obfuscate:
    [taskdef] Could not load definitions from resource proguard/ant/task.properties. It could not be found.
    

    I have outcommented the hasProguardAndMIDP variable in the build.properties for now.
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    If you've modified the build system, it is very difficult for us to determine what is wrong. If you have you're environment configured correctly (consult your toolkit documentation as well as the IceE for Java INSTALL and README files), then you should not need to modify any ant files in order to build the demos correctly.

    If you need to modify the demo build system for some reason, I recommend that you consult the ant documentation and use the original build.xml files while making changes. With the exception of the slice2javae task, the IceE for Java build system is pretty generic. If you don't really require a customized build, I recommend starting over by unpacking a fresh distribution (move or delete the previous one first) and proceeding with the knowledge you've gained so far.

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    the build.xml seems faulty

    I have the following software installed:
    jdk-6-windows-i586.exe (java version 1.6.0_01),
    j2me_wireless_toolkit-2_2-windows.exe (generates a C:\WTK22 folder),
    Ice-3.2.0,
    IceEJ-1.1.0 with bin folder added from IceE-trans-1.1.0-bin-win.zip

    I have reinstalled IceEJ-1.1.0, only changed the config\build.properties to:
    debug = on
    WTK = C:/WTK22

    In the folder C:\IceEJ-1.1.0\demo\IceE\midp\hello, I run these commands in a commandwindow:

    ant clean

    ant

    Heres the output:
    C:\IceEJ-1.1.0\demo\IceE\midp\hello>ant
    Buildfile: build.xml
    config-init:
    init:
    generate:
        [mkdir] Created dir: C:\IceEJ-1.1.0\demo\IceE\midp\hello\generated
    [slice2javae] slice2javae  --output-dir C:\IceEJ-1.1.0\demo\IceE\midp\hello\gene
    rated C:\IceEJ-1.1.0\demo\IceE\jdk\hello\Hello.ice
    
    compile:
        [mkdir] Created dir: C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
        [javac] Compiling 8 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
        [javac] Compiling 2 source files to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
    
    client-jar:
        [mkdir] Created dir: C:\IceEJ-1.1.0\demo\IceE\midp\hello\tmp
         [copy] Copying 1 file to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
          [jar] Building jar: C:\IceEJ-1.1.0\demo\IceE\midp\hello\tmp\HelloClient.ja
    r
          [jar] Updating jar: C:\IceEJ-1.1.0\demo\IceE\midp\hello\tmp\HelloClient.ja
    r
    
    client-obfuscate:
    
    client-preverify:
         [exec] JAR file creation failed with error -1
         [exec] The preverified classes if any are in tmp29016. See jar log of error
    s in .\jarlog.txt
         [exec] Result: 1
    
    client-jad:
       [length] C:\IceEJ-1.1.0\demo\IceE\midp\hello\HelloClient.jar does not exist
    
    server-jar:
         [copy] Copying 1 file to C:\IceEJ-1.1.0\demo\IceE\midp\hello\classes
          [jar] Building jar: C:\IceEJ-1.1.0\demo\IceE\midp\hello\tmp\HelloServer.ja
    r
          [jar] Updating jar: C:\IceEJ-1.1.0\demo\IceE\midp\hello\tmp\HelloServer.ja
    r
    
    server-obfuscate:
    
    server-preverify:
         [exec] JAR file creation failed with error -1
         [exec] The preverified classes if any are in tmp29019. See jar log of error
    s in .\jarlog.txt
         [exec] Result: 1
    
    server-jad:
       [length] C:\IceEJ-1.1.0\demo\IceE\midp\hello\HelloServer.jar does not exist
    
    all:
    
    BUILD SUCCESSFUL
    Total time: 3 seconds
    
    

    Why the hello\HelloServer.jar does not exist is because the rebuilt HelloServer.jar is placed in the tmp folder. So I would very much appreciate if you can rebuild this application (with ant clean command first..) to see what you get. If you succeed I would very much like to know what Java version, j2me wireless toolkit you have used. Thanks .
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    beagles wrote: »
    ....If you have you're environment configured correctly (consult your toolkit documentation as well as the IceE for Java INSTALL and README files), then you should not need to modify any ant files in order to build the demos correctly.

    I still think that the build.xml (for use with ant) is faulty. Can someone check that? If u first clean out the *.jar and *.jad (ant clean) and then rebuild it (ant), can u run these in the emulator?

    Cause I cant. Thanks for your time and effort ;)
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    I can ;)

    Which version of ant are you using?

    It's a little weird that the jar error you were getting before was coming from the preverify task. Have you tried performing the build steps manually using the same environment? That would help identify any environmental issues or possible bugs with the toolchain.

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    I am running windows xp sp2.
    I am using this version of ant: apache-ant-1.7.0-bin.zip

    In my version of build.xml the *.jad cant find the *.jar cause they are not in the same folder:
    .....
    <jar destfile="tmp/HelloClient.jar" manifest="CLIENTMANIFEST.MF" excludes="ServerMIDlet*.class" basedir="classes"/>
    ........
    <target name="client-jad" depends="client-preverify" if="midp">
      <length property="client-jarfile-length" file="HelloClient.jar"/>...
    
    What Java version, ant-version, J2ME Toolkit do you use?
  • beaglesbeagles Brent EaglesOrganization: Eagles Technologies IncProject: Asterisk SCFMember ✭✭✭
    There should be a jar where the client-jad target expects it to be. This isn't the case for you because the preverify step is failing. Have you tried running preverify manually to 'verify' that your toolchain is functioning properly?

    We are currently using ant 1.6.5, and Sun WTK 2.5 or Nokia S40 Platform SDK 2nd edition on Windows XP. I've also checked WTK 2.2 and WTK 2.3 beta and everything works fine.

    Cheers,

    Brent
  • westcoastwestcoast Erik LovbomOrganization: Umea UniversityProject: pervasive computingMember
    When i run the command in the "jarlog.txt" a HelloServer.jar is created:

    jar -cfm "./HelloServer.jar" tmp25805\\META-INF\MANIFEST.MF -C tmp25805 .

    When i change the parameters to the tmp catalog for the HelloClient.jar, the HelloClient.jar is created.

    I then fill in the *.jar size in the *.jad.

    Then they are ok to run. Strange that the preverify fails.

    I will now try to build them without using this particular ant-file. Get back to this thread when I have tried that.
Sign In or Register to comment.