Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compiler error -- can't locate package

 
Jason Long
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jason Long
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 170
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank-you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic