Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603399
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:38:47+00:00 2026-05-30T23:38:47+00:00

I have build a jar file and trying to use it in j2me application.

  • 0

I have build a jar file and trying to use it in j2me application. I have included the jar in the build path and imported the required classes as well. But when I run my j2me application I am getting NoClassDefFound Error in the line where I am trying to instantiate the class which is present in the jar.

I can instantiate the classes of the jar in the java project but not in j2me.

Below is the error log:

WARNING – MMA –
C:/Builds/jme-sdk/javacall-javame-sdk-305/implementation/share/jsr135_mmapi/ju_mmconfig.c
line 801: caps: optional settings missing: SuspendBehavior
java.lang.NoClassDefFoundError: com/canvasm/ida/gps/LocationUpdater
– com.test.ida.HelloIDA.(HelloIDA.java:11)
– java.lang.Class.newInstance(), bci=0
– com.sun.midp.main.CldcMIDletLoader.newInstance(), bci=46
– com.sun.midp.midlet.MIDletStateHandler.createMIDlet(), bci=66
– com.sun.midp.midlet.MIDletStateHandler.createAndRegisterMIDlet(), bci=17
– com.sun.midp.midlet.MIDletStateHandler.startSuite(), bci=27
– com.sun.midp.main.AbstractMIDletSuiteLoader.startSuite(), bci=52
– com.sun.midp.main.CldcMIDletSuiteLoader.startSuite(), bci=8
– com.sun.midp.main.AbstractMIDletSuiteLoader.runMIDletSuite(), bci=161
– com.sun.midp.main.AppIsolateMIDletSuiteLoader.main(), bci=26 javacall_lifecycle_state_changed() lifecycle: event is
JAVACALL_LIFECYCLE_MIDLET_SHUTDOWN status is JAVACALL_OK

TestApp(j2me app):

import com.test.gps.LocationUpdater;

public class Hello extends MIDlet {

public Hello() {
    LocationUpdater loc = new LocationUpdater();
    System.out.println("Loc updater object :"+loc.toString());
}

protected void destroyApp(boolean arg0) throws MIDletStateChangeException {
    // TODO Auto-generated method stub

}

protected void pauseApp() {
    // TODO Auto-generated method stub

}

protected void startApp() throws MIDletStateChangeException {


}

}

JAR file main class:

public class LocationUpdater {

private boolean isUpdateSuccess = false;


public static void main(String[] args){


}

public boolean updateLocation(final String serverUrl, final String userMSISDN) throws LocationException{
    AppConstants.url = serverUrl;
    AppConstants.msisdn = userMSISDN;

    LocationCanvas loc = new LocationCanvas();
    isUpdateSuccess = loc.getLocation(serverUrl, userMSISDN);

    return isUpdateSuccess;
}

}

LocationCanvas class:

 public class LocationCanvas {

private Location location;
private LocationProvider locationProvider;
private Coordinates coordinates;
private Criteria criteria;
private Timer tm;
private double lat, lon;
private String posturl;
private boolean status,updateStatus;

public LocationCanvas() {


}

public boolean getLocation(String url, String msisdn) {

    tm = new Timer();

    criteria = new Criteria();
    criteria.setHorizontalAccuracy(500);

    try {

        locationProvider = LocationProvider.getInstance(criteria);

        if (locationProvider != null) {

            tm.wait(4000);

            try {
                location = locationProvider.getLocation(2000);
            } catch (Exception e) {
                System.out.println(e.getMessage());
            }

            coordinates = (Coordinates)location.getQualifiedCoordinates();
            if (coordinates != null) {
                // Use coordinate information
                lat = coordinates.getLatitude();
                lon = coordinates.getLongitude();

                System.out.println("Latitude :"+lat);
                System.out.println("Longitude :"+lon);
            }

            posturl = url + "?IMEI=" + msisdn
                    + "&positioningtype=" + "gps" + "&locationdata=" + lat
                    + "," + lon;


        }else{
            //return false.. cos location provider is null
            updateStatus = false;
        }
    } catch (Exception e) {
        System.out.println(e.getMessage());
    }
    return updateStatus;

}

error log:

Exception in thread "main" java.lang.NoClassDefFoundError:
    javax/microedition/location/Coordinates
at com.canvasm.ida.gps.LocationUpdater.updateLocation(LocationUpdater.java:17)
at com.test.HelloTest.main(HelloTest.java:10)
Caused by: java.lang.ClassNotFoundException: javax.microedition.location.Coordinates
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)

Any help would be appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:38:48+00:00Added an answer on May 30, 2026 at 11:38 pm

    Finally able to solve the issue.
    The problem was not in the code. It was due to the compilation issue.

    First of all To solve the NoClassDefFoundError , I had to right click on the project and in the build path-> order and export -> check the jar that you have added.

    Later while running I faced classFormatError 56.

    The jar file which was created, was compiled using 1.6v.
    And the j2me application was getting compiled with 1.3v.

    I had to recompile my library project with 1.3v and create a jar out of it and used it in the j2me application.

    Here is the link to guide: Build a Project from the Command Line – Java ME SDK

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a jar file usign maven2 build. I am trying to run
I am trying to create and use jar file in an Android project under
I'm trying to run a .jar file with the command java -jar Filename.jar, but
I'm trying to use Maven to create an executable jar file that includes the
I am trying to use the Maven assembly plugin to build a jar-with-dependencies, except
I am trying to build a Java EE application using Maven. I have the
I'm new to Java. I'm simply trying to build a .jar file of my
I have a build that depends on com.odiago.avro:odiago-avro:jar:1.0.5 , which I've been unable to
I have a Maven build with three modules. Module A exports a jar. Module
I have a simple Android application that uses a JAR I have built. When

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.