来自同一项目的另一个包的java导入在我的eclipse中不起作用

jei2mxaa  于 2021-08-25  发布在  Java
关注(0)|答案(0)|浏览(244)

在这里输入图像描述我有一个名为“projectwithmaven”的java项目。在src/main/java中,我创建了不同的包com.states、com.tutorial、com.map等。现在我想要一个java实体类studenttable从com.tutorial进入我的com.states java主类“statedemo.java”,如下所示//主pgm

  1. package com.states;
  2. import org.hibernate.Session;
  3. import org.hibernate.SessionFactory;
  4. import org.hibernate.Transaction;
  5. import org.hibernate.cfg.Configuration;
  6. import com.tutorial.StudentTable;
  7. public class StateDemo {
  8. public static void main(String[] args) {
  9. System.out.println("Eg:- ");
  10. SessionFactory f= new Configuration().configure("hibernate.cfg.xml").buildSessionFactory();
  11. //Create Student OBJECT:
  12. StudentTable std = new StudentTable;
  13. //properties SET: Get
  14. std.setStudName("Samudra Dutta Gupta");
  15. std.setStudRno(54);
  16. Session s = f.openSession();
  17. Transaction tx = s.beginTransaction();
  18. s.save(std);
  19. tx.commit();
  20. s.close();
  21. f.close();
  22. }

}//主类
studenttable std=new studenttable()即使在导入studenttable类后,仍会显示错误以改进该类。
但我无法从com.tutorial.studenttable导入studenttable。它不断显示导入/项目修复等选项。。。和其他选择
(注意:studenttable是一个java实体类。我也在使用JavaHibernate)。我无法理解我犯了什么错误。我无法删除正在停止运行主类的错误。
我正在使用EclipseIDE。它是否与eclipse配置有关?

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题