views:

21

answers:

1

Hello,

I'm working on a JavaME project and need to import external libraries, which are available to me as jar files. So I selected the project properties -> libraries & resources -> add Jar/Zip and added the jar file there.

When editing the code, everything works. I can import the classes from this library and use them as expected. But when I try to compile the project, I'm getting the error...

package <packagename> does not exist

...at the line

import <packagename>.<classname>;

Like I said, no error or warning shows up when editing the code. The library is correctly shown in the project view under "Resources" and the Netbeans autocomplete works as well. The error occurs only when compiling.

I'm quite sure, there's a simple solution to this, but I just can't find it.

Thanks in advance for any help or tips!

A: 

Once in a while the ant script (nbproject/build-impl.xml) will get out of sync with the project (nbproject/project.properties). This is easily fixed by makinga another change to the project to encourage NB to rewrite the ant script.

Open the project properties dialog (File > Project properties) and select Compiling. Toggle the state of Compile on Save. Click OK to close the dialog and rewrite the ant script. Give it a moment to be sure it's not busy scanning the project (Status displayed in the bottom right.) Then open the dialog again and toggle the value back. Close the dialog and try compiling again.

Devon_C_Miller
Thanks for your answer, but I'm afraid, the problem still exists. I even don't have the "Compile on Save" option. All I see there is "Generate Debugging Info", "Compile with Optimization" and "Report Uses of Deprecated APIs". Perhaps that's because it's a J2ME-Project?I also checked the "build" folder of the project, where Netbeans puts temporary files during the build. There's no sign of the jar library. I really don't know, what's going wrong. This isn't my first Netbeans project and I used jar libraries before. I just added them to the project and it worked. *shrug*
ceefar