IntelliJ右键点击时没有显示包选项。

huangapple go评论79阅读模式
英文:

Intellij doesnt show package option when I right click

问题

IntelliJ右键点击时没有显示包(package)选项,我想在项目中创建新的包(package)。
我附上了截图。有人知道解决方法吗?
链接图片描述在这里

英文:

Intellij doesnt show package option when I right click, I was trying to create new package on my project.
I am adding the screenshot. Is there anybody know the solution?
enter image description here

答案1

得分: 4

请确保:

  1. 模块是 Java 类型的。
  2. 您尝试创建包或 Java/Kotlin 类的目录被标记为源代码根类型
英文:

Make sure that

  1. the module of the Java type
  2. the directory where you are trying to create a package or a Java/Kotlin class is marked as a source root type.

答案2

得分: 1

问题已经在以下帖子中得到了回答,从Java术语的角度来看,目录(directories)和包(packages)之间的区别非常小。

标记目录为源根(source root)意味着它包含了所有必要的代码,这些代码将被部署并且在运行应用程序时将被需要。

根据我的个人经验,当目录只是目录时,我找不到一种在其中创建类的方法,但是将它们标记为源根并告诉IntellJ Idea源代码在这里,因此它可以突出显示它们,实际上查找错误并在应用程序开发中支持我们。

英文:

The question already answered, as per the following thread there is very little difference between directories and packages in java parlance.

IntelliJ右键点击时没有显示包选项。

Marking a directory as the source root means, it contains all the necessary code which will be deployed and will be required to run the application.

In my personal experience I could not find a way to create classes when the directories were just directories, but marking them as source root and tells IntellJ Idea that the source code is here so it can highlight them and actually look for errors and support us in our development of application.

huangapple
  • 本文由 发表于 2020年9月23日 22:06:30
  • 转载请务必保留本文链接:https://go.coder-hub.com/64029790.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定