InteliJ IDEA

编程入门 行业动态 更新时间:2024-10-24 08:21:35
InteliJ IDEA - 运行代码或调试不工作(灰色)(InteliJ IDEA - Run code or debug not working ( Greyed out))

所以我有这个问题,无法自己找到解决方案。 我相信我已经正确设置了IDEA,因为当我启动一个新项目并使用提供的模板时,我可以添加自己的代码并运行正常!

但是,当我尝试从包中编译的教程(com.exmaple.java)中打开一些示例代码时,问题就出现了,例如教程材料目录:C:\ Users \ Edgar \ Desktop \ Ex_Files_JavaEssT_Q32015 \ Exercise Files \ Ch04 \ 04_03 \货币的\ src \ COM \例子\ java中。

我试过打开curency部分,src部分和文件本身,但没有任何作用,我无法运行这些教程的代码。 查看我的想法的截图 。

so i have this problem and cannot find solution on my own. I believe i have set up IDEA correctly , because when i start a new project and use the provided template i can add my own code and run it fine!

However the problem happens when i am trying to open some example code from tutorials that are compiled in packages ( com.exmaple.java) e.g of tutorial material directory: C:\Users\Edgar\Desktop\Ex_Files_JavaEssT_Q32015\Exercise Files\Ch04\04_03\Currency\src\com\example\java.

I have tried opening on the curency part , the src part and the files themselves but nothing works and i cannot run code of these tutorials. See screenshot for my Idea.

最满意答案

我想你应该将“src”目录标记为Sources Root。 只需右键单击“src”目录,选择Mark Directory as - > Sources Root

用于标记目录的上下文菜单

I guess that you should mark the "src" directory as Sources Root. Just right click the "src" directory, choose Mark Directory as -> Sources Root

The Context menu to mark the directory

更多推荐

本文发布于:2023-07-06 07:28:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1047331.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:InteliJ   IDEA

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!