简体   繁体   中英

import javax.persistence.EntityManager error

I have copied my project from pc to other and i got error

  1. import javax.persistence.EntityManager; importjavax.persistence.EntityManagerFactory; import javax.persistence.Persistence; import javax.persistence.Query;

the compiler doesn't know them, in the lib folder i added 3 jar from the local pc derby.jar eclipselink.jar and also javax.persistence_2.0.4.v201112161009.jar

what could be the reason

add two more Jar's that are

toplink-essentials.jar
toplink-essentials-agent.jar

Add this external jars to your project

at first refresh your project, if you copied with OS.

then maybo you have to add them to your build path.

1 right click on your project -> build path -> configure build path -> libraries -> add JARs...

2 select project/lib folder and choose the jars to add them.

3 click OK

All you need is to add those jar on classpath . If you are running the project in eclipse, simply select project properties=>build path=>add jar

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM