导入javax.persistence.EntityManager错误

时间:2013-02-07 09:35:35

标签: java eclipse jpa eclipselink

我已将我的项目从pc复制到其他,我收到了错误

  1. import javax.persistence.EntityManager; importjavax.persistence.EntityManagerFactory;进口 javax.persistence.Persistence; import javax.persistence.Query;
  2. 编译器不知道它们,在lib文件夹中我从本地pc添加了3个jar derby.jar eclipselink.jar以及javax.persistence_2.0.4.v201112161009.jar

    可能是什么原因

3 个答案:

答案 0 :(得分:1)

添加另外两个

的Jar
toplink-essentials.jar
toplink-essentials-agent.jar

将此外部罐子添加到您的项目中

答案 1 :(得分:0)

首先刷新你的项目,如果你复制了OS。

然后maybo你必须将它们添加到你的构建路径。

在您的项目中

1 右键单击 - > 构建路径 - > 配置构建路径 - > libraries - > 添加JAR ...

2选择project / lib文件夹并选择要添加的jar。

3单击确定

答案 2 :(得分:0)

您只需要在 classpath 上添加这些jar。如果您在eclipse中运行项目,只需选择项目属性=>构建路径=>添加jar

相关问题