环境
操作系统:win7
IntelliJ IDEA: 2017.3 Ultimate
需求
我上一篇,讲解完,项目的导入。
之后我发现,有些包名报错。弄得的我设置了很久,才设置对了,再次记录下
正确的做法
假设我们类的路径是asd/com/stackoverflow/Test.java
这样的;
对于Test.java
而言,包名是:com.stackoverflow
则,
我们就要把asd
设置为Sources
。
我的配置
遇到的错误
要是没有设置正确,会出现如下错误:
英文如下:
Package name '' does not correspond to the file path '' Detects package statements that do not correspond to the project directory structure and reports classes without package statements
参考地址: