英文:
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
请确保:
- 模块是 Java 类型的。
- 您尝试创建包或 Java/Kotlin 类的目录被标记为源代码根类型。
英文:
Make sure that
- the module of the Java type
- 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.
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论