tags:

views:

167

answers:

2

I have a class uses the following lines, it works fine in a Google App Engine project:

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

But when I included this class in another project, it cause error : package javax.jdo.annotations does not exist

What should I do to find javax.jdo.* ?

Frank

A: 

Add the JDO jar file to the class path.

diciu
+1  A: 

The star notation for imports isn't working the way you think it does.

It's not recursive - it only applies the child classes in javax.jdo, not the child packages.

If you want all the classes in javax.jdo.annotations, you'll need to import javax.jdo.annotations.*, too.

I'd recommend not using the star notation. Better to type out the imports for every class individually. Use an IDE to help you. It's clearer for you and other programmers who come after you where those classes came from.

duffymo