×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Registered User
    Join Date
    Oct 2009
    Posts
    11

    [WARN] [rms ] javacall_file_open:

    Hello,

    can some1 tell me what's wrong with this code?? configuration is set to cldc1.1 and midp 2.1 but emulator wont run jar file and phone still says invalid jar file

    Code:
    import javax.microedition.lcdui.Command;
    import javax.microedition.lcdui.CommandListener;
    import javax.microedition.lcdui.Display;
    import javax.microedition.lcdui.Displayable;
    import javax.microedition.lcdui.Form;
    import javax.microedition.lcdui.StringItem;
    import javax.microedition.location.Coordinates;
    import javax.microedition.location.Criteria;
    import javax.microedition.location.Location;
    import javax.microedition.location.LocationException;
    import javax.microedition.location.LocationProvider;
    import javax.microedition.midlet.MIDlet;
    
    public class FindingPosition extends MIDlet implements CommandListener {
    
        private Display display;
        private Form form;
        private Command exitCommand;
        private Command refreshCommand;
        private StringItem text;
        
        private Location location;
        private LocationProvider locationProvider;
        private Coordinates coordinates;
        private Criteria criteria;
    
        /**
         * Constructor. Constructs the object and initializes displayables.
         */
        public FindingPosition() {
            
        }
    
        /**
         * From MIDlet.
         * Called when the MIDlet is started.
         */
        public void startApp() {
            form = new Form("Finding location.");
    
            exitCommand = new Command("Exit", Command.EXIT, 2);
            refreshCommand = new Command("Refresh", Command.OK, 1);
    
            text = new StringItem("Your position:", "\nPress \"Refresh\"");
            form.append(text);
    
            form.addCommand(exitCommand);
            form.addCommand(refreshCommand);
            form.setCommandListener(this);
    
            display = Display.getDisplay(this);
            display.setCurrent(form);
    
            criteria = new Criteria();
            criteria.setHorizontalAccuracy(500);
    
            try {
                locationProvider = LocationProvider.getInstance(criteria);
            } catch (LocationException e) {
                //TODO: Handle location exception.
                return;
            }
            // No implementation required.
        }
    
        /**
         * From MIDlet.
         * Called to signal the MIDlet to enter the Paused state.
         */
        public void pauseApp() {
            // No implementation required.
        }
    
        /**
         * From MIDlet.
         * Called to signal the MIDlet to terminate.
         * @param unconditional whether the MIDlet has to be unconditionally
         * terminated
         */
        public void destroyApp(boolean unconditional) {
            // No implementation required
        }
    
        /**
         * From CommandListener.
         * Called by the system to indicate that a command has been invoked on a
         * particular displayable.
         * @param cmd the command that was invoked
         * @param displayable the displayable where the command was invoked
         */
        public void commandAction(Command c, Displayable d) {
            if (c == refreshCommand) {
                checkLocation();
            } else if (c == exitCommand) {
                notifyDestroyed();
            }
        }
    
        /**
         * Called to read current location.
         */
        private void checkLocation() {
            String string;
            
            try {
                location = locationProvider.getLocation(60);
            } catch (Exception e) {
                //TODO: Handle exception.
                return;
            }
            
            coordinates = location.getQualifiedCoordinates();
           
            if (coordinates != null)
            {
                // Use coordinate information 
                long lat =  (long) coordinates.getLatitude();
                
                long lon =  (long) coordinates.getLongitude();
                
                string = "\nLatitude : " + lat + "\nLongitude : " + lon;
            } 
            else
            {
                string = "Location API failed";
            }
            text.setText(string);
        }
    }

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

    Re: [WARN] [rms ] javacall_file_open:

    Your N95 won't run while it says "MIDP-2.1" in the JAR. It's a MIDP-2.0 device.

    What happens in the emulator? As much details as possible, please.

  3. #3
    Registered User
    Join Date
    Oct 2009
    Posts
    11

    Re: [WARN] [rms ] javacall_file_open:

    Quote Originally Posted by grahamhughes View Post
    Your N95 won't run while it says "MIDP-2.1" in the JAR. It's a MIDP-2.0 device.

    What happens in the emulator? As much details as possible, please.
    Says:

    "Select one to launch"

    The problem seems to be with the JSR179 spec since emulator displays same thing for all projects I implement it. but if i remove gps from code, compilation goes smoothly. any ideas???

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

    Re: [WARN] [rms ] javacall_file_open:

    It just says that? Nothing else???? You mean, the emulator doesn't even launch, because the app hasn't compiled?

    What error are you getting when you build?

  5. #5
    Registered User
    Join Date
    Oct 2009
    Posts
    11

    Re: [WARN] [rms ] javacall_file_open:

    Ok. this problem has been solved as i had to further configure the project by specifying a midlet If other problems show up i'll post here instead of opening new threads

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

    Re: [WARN] [rms ] javacall_file_open:

    You're best to start a new thread for a new problem. People tend to ignore old threads that already have lots of responses in them. New threads get more attention.

    Graham.

Posting Permissions

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