简体   繁体   English

Intellij IDEA 13.1中的Java编译错误

[英]Java compile error in Intellij IDEA 13.1

I got a code base from a source and trying to build using intellij Idea 13.1. 我从源代码获得了代码库,并尝试使用intellij Idea 13.1进行构建。 I am a .net guy and trying to set this up. 我是一个.net的人,并试图设置它。 Could you please help on how to resolve this error. 你能帮忙解决一下如何解决这个错误吗? I tried to setup the maven but no luck. 我试图设置maven但没有运气。

Information:Using javac 1.7.0_55 to compile java sources
Information:java: Errors occurred while compiling module 'main'
Information:Compilation completed with 100 errors and 0 warnings in 3 sec
Information:100 errors
Information:0 warnings
C:\Java\src\main\java\com\bc\testmod\models\MEntity.java
Error:(3, 1) java: package javax.persistence does not exist
Error:(12, 2) java: cannot find symbol
  symbol: class Entity
Error:(13, 2) java: cannot find symbol
  symbol: class Table

Assuming your codebase is maven-based I recommend you to do the following: 假设您的代码库是基于maven的,我建议您执行以下操作:

  1. Set up maven (this includes setting environment variable M2_HOME for Maven 2 and JAVA_HOME ) 设置maven(包括为Maven 2和JAVA_HOME设置环境变量M2_HOME
  2. Get a clean codebase (from VCS for example); 获得一个干净的代码库(例如来自VCS);
  3. Do File -> Open in IntelliJ Idea and open root pom.xml ; 执行文件 - >在IntelliJ Idea中打开并打开root pom.xml ;
  4. Let maven do its job - creating modules, downloading dependencies, etc. This may take a while. 让maven完成它的工作 - 创建模块,下载依赖项等。这可能需要一段时间。
  5. Now you need to build your project. 现在您需要构建您的项目。 Most likely you'll do that just as you doing it now. 你最有可能就像现在这样做。

Make sure that you have a JDK defined under: 确保您在以下位置定义了JDK:

File -> Project Structure -> SDKs 文件 - >项目结构 - > SDK

And that you project is associated with the SDK/JDK here: 并且您的项目与SDK / JDK相关联:

File -> Project Structure -> Project -> "Project SDK" 文件 - >项目结构 - >项目 - >“项目SDK”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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