File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java Micro Edition and the fly likes Compiler error -- can't locate package Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Mobile » Java Micro Edition
Reply Bookmark "Compiler error -- can Watch "Compiler error -- can New topic
Author

Compiler error -- can't locate package

Jason Long
Greenhorn

Joined: Dec 16, 2001
Posts: 17
Hello. I have a quick question for y'all. I am a newbie, and am having some trouble with building a MIDlet in Forte. I installed the J2ME developer kit after I installed Forte.
However, when I try to compile any file, I get this error message: "package javax.microedition.midlet does not exist". I get the same thing with the lcdui package. I have already checked the spelling. Also, does it matter if your package name is? Aka, does it have to match your class name? I appreciate any help!
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
What does your code look like? It should start something like this:
package com.foo.mypackage;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class MyMIDlet .......
The class name can be anything, although it's not recommended you duplicate the names in the java.lang package.

------------------
Eric Giguere
author/co-author of:
Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide
Java 2 Micro Edition: Professional Developer's Guide
PalmTM Database Programming: The Complete Developer's Guide


Eric Giguere
Author/Co-Author of: Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide, Java 2 Micro Edition: Professional Developer's Guide and PalmTM Database Programming: The Complete Developer's Guide
Jason Long
Greenhorn

Joined: Dec 16, 2001
Posts: 17
Eric -- Thanks for your help. It is much appreciated. I have what you suggested, and I still get the following error:
Yup/Howdy.java [3:1] package javax.microedition.midlet does not exist
import javax.microedition.midlet.*;
....etc.
17 errors
Errors compiling Howdy.

My code looks like this:
package J2mewtk.forte_example.Yup;
import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;
public class Howdy extends javax.microedition.midlet.MIDlet implements CommandListener {
Eric Giguere
Ranch Hand

Joined: Oct 25, 2000
Posts: 170
Your code looks fine, so it's obviously a problem with the classpath -- the MIDP classes aren't being found by Forte when it tries to compile your project. I don't use Forte, so I can't really help you there. You might want to try installing the standalone version of the J2ME Wireless Toolkit and using it instead -- that will definitely work. All you would do then is press the "New Project" button to create a new project directory for your MIDlet (found under c:\j2mewtk\apps, where c:\j2mewtk is the toolkit installation directory), place your source in the src directory of the project, and then hit the "Build" button the toolkit.
Have you checked the toolkit instructions for using it with Forte? I'm sure the problem is quite simple.

------------------
Eric Giguere
author/co-author of:
Mobile Information Device Profile for Java 2 Micro Edition: Professional Developer's Guide
Java 2 Micro Edition: Professional Developer's Guide
PalmTM Database Programming: The Complete Developer's Guide
Jason Long
Greenhorn

Joined: Dec 16, 2001
Posts: 17
Thank-you!
 
 
subject: Compiler error -- can't locate package
 
Threads others viewed
Cant get applets to run under Forte, Help!
PLEASE, I need help with this..............
import javax.servlet.* error
Cant get applets to run under Forte, Help!
JUnit 3.7 in Forte 3.0 CE
IntelliJ Java IDE