Menu

Running Hello World Example

AFME
hakan cam
2010-03-18
2013-03-03
1 2 > >> (Page 1 of 2)
  • hakan cam

    hakan cam - 2010-03-18

    Hi everybody,

    I have been trying to execute the HelloWorld example following the AFME Programmers Guide. These were the things what i did:
    1. I have obtained the "HelloWorldlet.java" and "HelloWorldAgentPlatform.java" files and compiled them using the AFME compiler. Then i have created a manifest file using a text editor. Its content is listed below.

    MIDlet-1: helloworld_console, , helloworld.HelloWorldlet
    MIDlet-Name: helloworld_console
    MIDlet-Vendor: My Organization
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.1

    2. and then i have packaged the class files, manifest file and "afme3_3.jar" file into a jar file. Then i have created a JAD file. Its content listed below:

    MIDlet-1: helloworld_console, helloworld_console.png, helloworld.HelloWorldlet
    MIDlet-Jar-Size: 77165
    MIDlet-Jar-URL: helloworld_console.jar
    MIDlet-Name: helloworld_console
    MIDlet-Vendor: Unknown
    MIDlet-Version: 1.0
    MicroEdition-Configuration: CLDC-1.1
    MicroEdition-Profile: MIDP-2.1

    3. İ have created a new project in the toolkit.  Then i have copied all the files from my folders to related toolkit folders.

    When i have tried to open and build the project in toolkit i have got this error mesage.

    Project "helloworld_console" loaded
    Project settings saved
    Building "helloworld_console"
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:3: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.Actuator;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:4: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.AffectManager;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:5: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.FOS;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:7: cannot find symbol
    symbol: class Actuator
    public class HelloAct extends Actuator {
                                  ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:8: cannot find symbol
    symbol  : class AffectManager
    location: class helloworld.HelloAct
        public HelloAct(AffectManager manager) {
                        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloAct.java:12: cannot find symbol
    symbol  : class FOS
    location: class helloworld.HelloAct
        public boolean act(FOS action) {
                           ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:6: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.FOS;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:8: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.RoleLibrary;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:9: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.RoleTemplate;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:10: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.BelSeq;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:12: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.AgentName;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:19: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.UserInterface;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:20: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.MIDletRunnable;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:21: package com.agentfactory.cldc.scheduler does not exist
    import com.agentfactory.cldc.scheduler.AgentRunnable;
                                          ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:23: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.PerceptionManager;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:24: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.AffectManager;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:25: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.Perceptor;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:26: package com.agentfactory.cldc.scheduler does not exist
    import com.agentfactory.cldc.scheduler.Scheduler;
                                          ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:27: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.TerImplication;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:28: package com.agentfactory.cldc.logic does not exist
    import com.agentfactory.cldc.logic.Agent;
                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:33: package com.agentfactory.cldc does not exist
    import com.agentfactory.cldc.Platform;
                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:36: package com.agentfactory.cldc.mts does not exist
    import com.agentfactory.cldc.mts.IDSet;
                                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:37: package com.agentfactory.cldc.mts does not exist
    import com.agentfactory.cldc.mts.AID;
                                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:41: cannot find symbol
    symbol: class Platform
    public class HelloWorldAgentPlatform implements CommandListener,Platform{
                                                                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:45: cannot find symbol
    symbol  : class Scheduler
    location: class helloworld.HelloWorldAgentPlatform
        Scheduler scheduler;
        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:46: cannot find symbol
    symbol  : class UserInterface
    location: class helloworld.HelloWorldAgentPlatform
        UserInterface inter;
        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:155: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
        public AgentName createName(String agentName){
               ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:210: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
        private MIDletRunnable helloworld_HelloAgent(AgentName name,int res){
                                                     ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:210: cannot find symbol
    symbol  : class MIDletRunnable
    location: class helloworld.HelloWorldAgentPlatform
        private MIDletRunnable helloworld_HelloAgent(AgentName name,int res){
                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:303: cannot find symbol
    symbol  : class IDSet
    location: class helloworld.HelloWorldAgentPlatform
        public void addIDs(Object name,IDSet ident){
                                       ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:316: cannot find symbol
    symbol  : class FOS
    location: class helloworld.HelloWorldAgentPlatform
        public void storeName(FOS name){
                              ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:61: cannot find symbol
    symbol  : class AgentRunnable
    location: class helloworld.HelloWorldAgentPlatform
        AgentRunnable Alice;
        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:62: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
        AgentName AliceName;
        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:69: cannot find symbol
    symbol  : class Scheduler
    location: class helloworld.HelloWorldAgentPlatform
            scheduler=new Scheduler(1);
                          ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:121: cannot find symbol
    symbol  : variable FOS
    location: class helloworld.HelloWorldAgentPlatform
           Alice.addFOSBelief(FOS.createFOS("always(sayHello)"));
                              ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:138: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
            final AgentName agentName=new AgentName;
                  ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:138: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
            final AgentName agentName=new AgentName;
                                            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:157: cannot find symbol
    symbol  : variable AgentName
    location: class helloworld.HelloWorldAgentPlatform
                String smpNm=storeData_.substring(0,storeData.indexOf(AgentName.DELIM));
                                                                           ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:158: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
                if(smpNm.equals(agentName))return new AgentName(storeData,"HelloWorld");
                                                      ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:160: cannot find symbol
    symbol  : class AgentName
    location: class helloworld.HelloWorldAgentPlatform
            return new AgentName(agentName,"HelloWorld");
                       ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:179: package com.agentfactory.cldc does not exist
            ((com.agentfactory.cldc.Service)en.nextElement()).destroy();
                                   ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:193: cannot find symbol
    symbol  : class AgentRunnable
    location: class helloworld.HelloWorldAgentPlatform
                AgentRunnable agent=(AgentRunnable)agents.get(list.getString(list.getSelectedIndex()));
                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:193: cannot find symbol
    symbol  : class AgentRunnable
    location: class helloworld.HelloWorldAgentPlatform
                AgentRunnable agent=(AgentRunnable)agents.get(list.getString(list.getSelectedIndex()));
                                     ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:212: cannot find symbol
    symbol  : class Perceptor
    location: class helloworld.HelloWorldAgentPlatform
            Perceptorperceptor=new Perceptor;
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:212: cannot find symbol
    symbol  : class Perceptor
    location: class helloworld.HelloWorldAgentPlatform
            Perceptorperceptor=new Perceptor;
                                     ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:214: cannot find symbol
    symbol  : class RoleLibrary
    location: class helloworld.HelloWorldAgentPlatform
            RoleLibrary roleLib=new RoleLibrary();
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:214: cannot find symbol
    symbol  : class RoleLibrary
    location: class helloworld.HelloWorldAgentPlatform
            RoleLibrary roleLib=new RoleLibrary();
                                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:215: cannot find symbol
    symbol  : class BelSeq
    location: class helloworld.HelloWorldAgentPlatform
            BelSeq arr=null;
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:230: cannot find symbol
    symbol  : class TerImplication
    location: class helloworld.HelloWorldAgentPlatform
            TerImplicationmentalState=new TerImplication;
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:230: cannot find symbol
    symbol  : class TerImplication
    location: class helloworld.HelloWorldAgentPlatform
            TerImplicationmentalState=new TerImplication;
                                            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:231: cannot find symbol
    symbol  : class BelSeq
    location: class helloworld.HelloWorldAgentPlatform
            arr=new BelSeq;
                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:233: cannot find symbol
    symbol  : class TerImplication
    location: class helloworld.HelloWorldAgentPlatform
            mentalState=new TerImplication("printHello1",new BelSeq("sayHello|1",arr,bool));
                               ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:233: cannot find symbol
    symbol  : class BelSeq
    location: class helloworld.HelloWorldAgentPlatform
            mentalState=new TerImplication("printHello1",new BelSeq("sayHello|1",arr,bool));
                                                                ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:236: cannot find symbol
    symbol  : class Agent
    location: class helloworld.HelloWorldAgentPlatform
            Agent agent=new Agent(mentalState,actuator,perceptor,modules,roleLib,res);
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:236: cannot find symbol
    symbol  : class Agent
    location: class helloworld.HelloWorldAgentPlatform
            Agent agent=new Agent(mentalState,actuator,perceptor,modules,roleLib,res);
                            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:237: cannot find symbol
    symbol  : class PerceptionManager
    location: class helloworld.HelloWorldAgentPlatform
            PerceptionManager perManager=new PerceptionManager(agent,name,modules,services,scheduler);
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:237: cannot find symbol
    symbol  : class PerceptionManager
    location: class helloworld.HelloWorldAgentPlatform
            PerceptionManager perManager=new PerceptionManager(agent,name,modules,services,scheduler);
                                             ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:238: cannot find symbol
    symbol  : class AffectManager
    location: class helloworld.HelloWorldAgentPlatform
            AffectManager affManager=new AffectManager(agent,name,modules,services,scheduler,roleLib);
            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:238: cannot find symbol
    symbol  : class AffectManager
    location: class helloworld.HelloWorldAgentPlatform
            AffectManager affManager=new AffectManager(agent,name,modules,services,scheduler,roleLib);
                                         ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:240: cannot find symbol
    symbol  : method register(java.util.Hashtable)
    location: class helloworld.HelloAct
            new HelloAct(affManager).register(actuator);
                                    ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:246: cannot find symbol
    symbol  : class MIDletRunnable
    location: class helloworld.HelloWorldAgentPlatform
            return new MIDletRunnable(agent,let,mentalState,roleLib,list);
                       ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:311: cannot find symbol
    symbol  : class AID
    location: class helloworld.HelloWorldAgentPlatform
        ident.addID(new AID(FOS.createFOS(s2.substring(8,ind2)),
                        ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:311: cannot find symbol
    symbol  : variable FOS
    location: class helloworld.HelloWorldAgentPlatform
        ident.addID(new AID(FOS.createFOS(s2.substring(8,ind2)),
                            ^
    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console\src\helloworld\HelloWorldAgentPlatform.java:312: cannot find symbol
    symbol  : variable FOS
    location: class helloworld.HelloWorldAgentPlatform
        FOS.createFOS(s2.substring(ind2+1,s2.length()-1))));
        ^
    64 errors
    com.sun.kvem.ktools.ExecutionException
    Build failed

    I couldn't figure out where exactly the problem lies. Would you please help me?

    Note:"Would you please give me short specific step by step instructions regarding how to run the Hello World Example?"

    Best regards.
    Hakan
    _

     
  • Conor

    Conor - 2010-03-18

    Hi Hakan,

    Probably the easiest way to compile the code is from the command line. See the following:

    http://supportweb.cs.bham.ac.uk/docs/java/j2me/UserGuide_HTML/ch_cline.html#wp7295

    The afme jar file should be added to the classpath. See the example in the above link, which illustrates how to add jars to the classpath.

    Best,
    Conor

     
  • hakan cam

    hakan cam - 2010-03-18

    Ok thanks.  i will try your suggestion.

     
  • hakan cam

    hakan cam - 2010-03-18

    Hi Mr.Conor Muldoon,

    I have followed the instructions in the link. I have compiled the "HelloAct.java" file using the following command line;

    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console>javac -d tmpclasses -bootclasspath C:\WTK2.5.2_01\lib\midpapi21.jar -classpath C:\WTK2.5.2_01\lib\cldcapi11.jar;C:\agentfactory\afme3_3.jar src\helloworld\*.java

    then i have preverified "HelloAct.class" file using the following command line;

    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console>preverify -classpath C:\WTK2.5.2_01\lib\midpapi21.jar;C:\agentfactory\afme3_3.jar;C:\WTK2.5.2_01\lib\cldcapi11.jar tmpclasses -d classes

    After that i have compiled the "HelloWorld.af" file using the following command line;

    java com.agentfactory.cldc.compiler.Main helloworld/HelloWorld.af

    and i have obtained the two java files, namely, "HelloWorldAgentPlatform.java" and "HelloWorldlet.java".

    Next when i have tried to compile these two files using the following command line i have got the following error message,

    C:\Documents and Settings\CAM\j2mewtk\2.5.2\apps\helloworld_console>javac -d tmpclasses -bootclasspath C:\WTK2.5.2_01\lib\midpapi21.jar -classpath C:\WTK2.5.2_01\lib\cldcapi11.jar;C:\agentfactory\afme3_3.jar src\helloworld\*.java

    src\helloworld\HelloWorldAgentPlatform.java:255: cannot access java.lang.StringBuilder class file for java.lang.StringBuilder not found
                            RecordStore rs = RecordStore.openRecordStore("HelloWorld"+s, true);
                                                                                                                                             ^
                                                                                                                                          Fatal Error: Unable to find method <init>

    Would you please help me to handle this problem. Many thanks indeed.

    Sincerely yours,
    Hakan.

     
  • Conor

    Conor - 2010-03-18

    Hi Hakan,

    Try adding the -target 1.3 option e.g.

    javac -d tmpclasses -bootclasspath C:\WTK2.5.2_01\lib\midpapi21.jar -classpath C:\WTK2.5.2_01\lib\cldcapi11.jar;C:\agentfactory\afme3_3.jar -target 1.3 src\helloworld\*.java

    Best regards,
    Conor

     
  • hakan cam

    hakan cam - 2010-03-18

    Dear Mr.Conor Muldoon,

    I have added the -target 1.3 and 1.4, and i have got the following message;

    javac: target release 1.3 conflicts with default source release 1.5
    javac: target release 1.4 conflicts with default source release 1.5

    Next, i have added the -target 1.5 and 1.6, and i have got the following message;

    src\helloworld\HelloWorldAgentPlatform.java:255: cannot access java.lang.StringBuilder class file for java.lang.StringBuilder not found
    RecordStore rs = RecordStore.openRecordStore("HelloWorld"+s, true);
    ^
    Fatal Error: Unable to find method <init>

    Finally, i have added the -target 1.7 and 1.8, etc. and i have got the following message;

    javac: invalid target release :1.7
    javac: invalid target release :1.8, etc.

    I am using JAVA SE DEVELOPMENT KIT (JDK), VERSION 6.

    Best regards,
    Hakan.

     
  • Conor

    Conor - 2010-03-18

    Hi Hakan,

    try adding -source 1.3, eg

    javac -d tmpclasses -bootclasspath C:\WTK2.5.2_01\lib\midpapi21.jar -classpath C:\WTK2.5.2_01\lib\cldcapi11.jar;C:\agentfactory\afme3_3.jar -target 1.3 -source 1.3 src\helloworld\*.java

    Regards,
    Conor

     
  • hakan cam

    hakan cam - 2010-03-18

    Hi Mr.Conor Muldoon,

    Thank you for your suggestion. I have successfully preverified classes, created a Manifest File, created an Application JAR File including class files, manifest file and agentfactory\afme3_3.jar file, created an Application JAD File and finally Run the Emulator using the following command,

    C:\WTK2.5.2_01\bin>emulator -Xdescriptor:helloworld_console\bin\helloworld_console.jad -classpath C:\WTK2.5.2_01\lib\midpapi21.jar;C:\agentfactory\afme3_3.jar;C:\WTK2.5.2_01\lib\cldcapi11.jar
     
    and i have gotten the following message,

    Running with storage root C:\Documents and Settings\CAM\j2mewtk\2.5.2\appdb\temp.DefaultColorPhone1
    Running with locale: English_United States.1252
    Running in the identified_third_party security domain

    and then DefaultColorPhone has been emerged. When i have selected helloworld_console and click the Launch button, i have gotten the following error message,

    Unable to create MIDlet helloworld.HelloWorldlet
    java.lang.ClassNotFoundException: helloworld/HelloWorldlet
            at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
            at com.sun.midp.midlet.Selector.run(+22)

    Note:I have copied "helloworld_console" project folder into the "C:\WTK2.5.2_01\bin".

    Best regards,
    Hakan.

     
  • Conor

    Conor - 2010-03-19

    hi,

    make sure the HelloWorldlet class file is in the jar file

     
  • hakan cam

    hakan cam - 2010-03-19

    Hi Mr.Conor Muldoon,

    I have rechecked the "helloworld_console.jar" file, there are three folders in it, namely, "helloworld" folder contains "HelloAct.class", "HelloAgent.sh", "HelloWorld.af", "HelloWorldAgentPlatform.class" and "HelloWorldlet.class" files. Second folder is "META-INF" contains "Manifest.mf" file. And the third folder "agentfactory" contains "afme3_3.jar" file.

    Best,
    Hakan.

     
  • Conor

    Conor - 2010-03-19

    Hi Hakan,

    Try running it without the jad e.g.

    emulator -Xdevice:DefaultColorPhone -classpath helloworld_console.jar;afme3_3.jar helloworld.HelloWorldlet

    Additionally, you jar file should not contain the afme3_3.jar.

    Alternatively, if you are using a jad, make sure the required jars are on the classpath

    C.

     
  • hakan cam

    hakan cam - 2010-03-19

    Hi Mr.Conor Muldoon,

    Problem still exists, whatever i have tried. First i have tried your first suggestion, the output is listed below;

    C:\WTK2.5.2_01\bin>emulator -Xdevice:DefaultColorPhone -classpath helloworld_console.jar;afme3_3.jar helloworld.HelloWorldlet
    Running with storage root C:\Documents and Settings\CAM\j2mewtk\2.5.2\appdb\DefaultColorPhone
    Running with locale: English_United States.1252
    Running in the identified_third_party security domain
    java.lang.ClassNotFoundException: helloworld/HelloWorldlet
            at com.sun.midp.midlet.MIDletState.createMIDlet(+29)
            at com.sun.midp.midlet.Scheduler.schedule(+52)
            at com.sun.midp.main.Main.runLocalClass(+28)
            at com.sun.midp.main.Main.main(+80)
    Execution completed.
    3349230 bytecodes executed
    18 thread switches
    1667 classes in the system (including system classes)
    17252 dynamic objects allocated (514516 bytes)

    the DefaultColorPhone pop ups and disappears suddenly.

    Secondly, i have deleted the afme3_3.jar from my jar file.

    Thirdly, i have tried using jad file, but problem sill continues.

    Would you mind if i send you my project folder by email?

     
  • Conor

    Conor - 2010-03-19

    Hi Hakam,

    Make sure the jar files are in the folder that you are running the emulator command from. This is problem is caused because the emulator cannot find the HelloWorldlet. This is just a question of getting used to how classpaths and the emulator work. It is not an AFME problem.

    Conor

     
  • hakan cam

    hakan cam - 2010-03-20

    Hi Mr. Conor Muldoon,

    I know, i am taking your time unnecessarily, i really appreciate it . I would like to thank you for your patience and consideration so far. I need your guidance, because i couldn' t manage to solve the problem yet.

    Best regards,
    Hakan.

     
  • Conor

    Conor - 2010-03-22

    Hi Hakan,

    That's ok :-) don't worry about it. I would suggest that you do a tutorial on the wireless toolkit (also see http://developer.mimer.com/howto/howto_78.htm).

    Best regards,
    Conor

     
  • hakan cam

    hakan cam - 2010-03-23

    Hi Mr.Conor Muldoon,

    Thanks a lot for your response. I have gone through the Sun Java Wireless Toolkit for CLDC UserGuide once again. I have followed the instructions. I have successfully compiled the files, preverified classes, created a Manifest File, created an Application JAR File, created an Application JAD File. I have copied the following jar files into bin directory of Toolkit.  helloworld_console.jar,
    afme3_3.jar,
    midpapi21.jar,
    cldcapi11.jar.

    I have also copied the helloworld folder of my project into bin directory of Toolkit.

    Finally i have Run the Emulator according to User Guide and i have the following error message.

    C:\WTK2.5.2_01\bin>emulator -Xdevice:DefaultColorPhone -classpath HelloSuite.jar;afme3_3.jar;midpapi21.jar;cldcapi11.jar helloworld.HelloWorldlet

    Running with storage root C:\Documents and Settings\CAM\j2mewtk\2.5.2\appdb\DefaultColorPhone
    Running with locale: English_United States.1252
    Running in the identified_third_party security domain

    Method…………: 24ae198 'helloworld/HelloWorldAgentPlatform.<init> (virtual)'
    Stack Chunk…….: 22bf82c
    Frame Pointer…..: 22bf958
    Current IP……..: 24adfb4 = 24adf94 + offset 32
    Previous Frame….: 22bf90c**

    Error verifying method com/agentfactory/cldc/scheduler/Scheduler <init>(I)V

    Approximate bytecode offset 86: Inconsistent or missing stackmap at ta**rget
    etc.

    Do you have any idea where the problem lies? Thank you very much indeed. I appreciate. I am looking forward to hearing you ASAP.

    Best regards,
    Hakan.

     
  • hakan cam

    hakan cam - 2010-03-24

    Dear Mr.Conor Muldoon,

    Thank you for your consideration and help. I have finally managed to run the HelloWorld example on the wireless toolkit . I really appreciate.

    Best regards,
    Hakan.

     
  • Conor

    Conor - 2010-03-24

    You're welcome,
    Best,
    Conor

     
  • David  Cemin

    David Cemin - 2011-12-04

    Hi everybody.

    I am having the same problem, and I could not get it working following the same steps that is mentioned in the comment 5 from this ticket.

    I'd like to run this example on a Powerpc processor with a JSE for Embedded, so I think I need to use the second *.java generated.

    Here is what I have in my directory, after running java -classpath ./comp3_3.jar com.agentfactory.cldc.compiler.Main helloworld/HelloWorld.af

    % ls
    HelloAct  HelloAgent.sh  HelloWorld.af  HelloWorldAgentPlatform.java  HelloWorldlet.java

    And I'd like to generate a .class file to use in my embedded system. So, I went like this:
    javac -d tmpclasses -bootclasspath /usr/java/WTK2.5.2/lib/midpapi21.jar -classpath /usr/java/WTK2.5.2/lib/cldcapi11.jar:/home/cemin/Dropbox/lib/java/afme/lib/afme3_3.jar *.java

    And I got the following error:

    HelloWorldAgentPlatform.java:240: cannot find symbol
    symbol  : class HelloAct
    location: class helloworld.HelloWorldAgentPlatform
            new HelloAct(affManager).register(actuator);
                ^
    1 error

    Any Ideas?

     
  • Conor

    Conor - 2011-12-05

    Hi,

    from your ls, it looks like your HelloAct file does not have a .java extension. try saving the file as HelloAct.java

     
  • David  Cemin

    David Cemin - 2011-12-05

    Yes, thats right, it seems that it was wrong. But now I have other problem:

    javac -d tmpclasses -bootclasspath /usr/java/WTK/lib/midpapi21.jar -classpath /usr/java/WTK/lib/cldcapi11.jar:/home/cemin/Dropbox/lib/java/afme/lib/afme3_3.jar *.java
    HelloWorldAgentPlatform.java:255: cannot access java.lang.StringBuilder
    class file for java.lang.StringBuilder not found
    RecordStore rs = RecordStore.openRecordStore("HelloWorld"+s, true);
                                                             ^
    Fatal Error: Unable to find method <init>

     
  • Conor

    Conor - 2011-12-05

    try adding -target 1.3
    see post 5

     
  • David  Cemin

    David Cemin - 2011-12-05

    Yes, it was already answered, sorry (again) for that.

    So, I manage to compile the code and I would like to run it in a command line environment. It is said in AFME Programming Guide:
    "The code can now be deployed to the device in question and can be executed by invoking the main method on the HelloWorldAgentPlatform class. "

    So, I tried to go to the directory where the classes are:

    % ls
    HelloAct.class  HelloWorldAgentPlatform.class  HelloWorldlet.class

    and tried to execute the main class from HelloWorldAgentPlatform, expecting to see some "hello world" on the terminal.

    I got the following error:

    % java HelloWorldAgentPlatform
    Exception in thread "main" java.lang.NoClassDefFoundError: HelloWorldAgentPlatform (wrong name: helloworld/HelloWorldAgentPlatform)
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    Could not find the main class: HelloWorldAgentPlatform.  Program will exit.

    The HelloWorldAgentPlatform.java contains the following method:

    58
    59     public HelloWorldAgentPlatform(HelloWorldlet let) {
    60

    So, am I still doing something wrong ? Does it make sense what I am trying to do ?

    Thank you !

     
  • Conor

    Conor - 2011-12-06

    have you changed the template to:

    template com/agentfactory/cldc/compiler/CDCAgentPlatform.template HelloWorldAgentPlatform;

    and recompiled the agent platform script to regenerate the code.

    (see Agent Platform without a GUI/MIDlet (for CDC devices) in the programmers' guide)

     
  • David  Cemin

    David Cemin - 2011-12-06

    Hi,

    Yes, i've done that, but it doesnt work. I'll paste below step by step. On the step four, I've tried with afme3_3.jar as well, an the output was the same. Thank you for your patience helping me out to solve this problem, that should be simple.

    1) The content of HelloWorld.af:
    % cat helloworld/HelloWorld.af
    package helloworld;
    platform HelloWorld{
        // Create 1 thread on the platform
    scheduler 1;
    create Alice helloworld.HelloAgent 1000;
    add Alice always(sayHello);
    start Alice;
    template com/agentfactory/cldc/compiler/CDCAgentPlatform.template HelloWorldAgentPlatform;
    }

    2) The "build agent" process:
    java -classpath /home/cemin/Dropbox/lib/java/afme/lib/comp3_3.jar com.agentfactory.cldc.compiler.Main helloworld/HelloWorld.af
    Processing: helloworld/HelloWorld.af
    Processing: com/agentfactory/cldc/compiler/CDCAgentPlatform.template
    Design File: helloworld/HelloAgent.sh
    Output File: /home/cemin/Dropbox/Master/agentes/afme/helloworld/HelloWorldAgentPlatform.java
    Completed: com/agentfactory/cldc/compiler/CDCAgentPlatform.template
    Completed: helloworld/HelloWorld.af

    3) The compilation line
    % cd -
    ~/Dropbox/Master/agentes/afme/helloworld
    % javac -d tmpclasses -bootclasspath /usr/java/WTK2.5.2/lib/midpapi21.jar -classpath /usr/java/WTK2.5.2/lib/cldcapi11.jar:/home/cemin/Dropbox/lib/java/afme/lib/afme_nointer3_3.jar -target 1.3 -source 1.3 *.java        

    4) The output errors:

    HelloWorldAgentPlatform.java:27: cannot find symbol
    symbol  : class File
    location: package java.io
    import java.io.File;
                  ^
    HelloWorldAgentPlatform.java:28: cannot find symbol
    symbol  : class RandomAccessFile
    location: package java.io
    import java.io.RandomAccessFile;
                  ^
    HelloWorldAgentPlatform.java:158: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorld"+s+".afme");
    ^
    HelloWorldAgentPlatform.java:158: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorld"+s+".afme");
               ^
    HelloWorldAgentPlatform.java:160: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
    ^
    HelloWorldAgentPlatform.java:160: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
                               ^
    HelloWorldAgentPlatform.java:173: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorld"+s+".afme");
    ^
    HelloWorldAgentPlatform.java:173: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorld"+s+".afme");
               ^
    HelloWorldAgentPlatform.java:174: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
    ^
    HelloWorldAgentPlatform.java:174: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
                               ^
    HelloWorldAgentPlatform.java:187: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorldNameStore.afme");
    ^
    HelloWorldAgentPlatform.java:187: cannot find symbol
    symbol  : class File
    location: class helloworld.HelloWorldAgentPlatform
    File f=new File("HelloWorldNameStore.afme");
               ^
    HelloWorldAgentPlatform.java:189: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
    ^
    HelloWorldAgentPlatform.java:189: cannot find symbol
    symbol  : class RandomAccessFile
    location: class helloworld.HelloWorldAgentPlatform
    RandomAccessFile raf = new RandomAccessFile(f, "rw");
                               ^
    14 errors

     
1 2 > >> (Page 1 of 2)

Log in to post a comment.

Auth0 Logo