[英]How to edit configurations of IDE to run a java application...? (IntelliJ)
I know how to run my Java program from the command line.我知道如何从命令行运行我的 Java 程序。 My path to
Main.java
is:我的
Main.java
路径是:
my_dir/turtlesolution
turtlesolution
has the following: turtlesolution
有以下几点:
Main.java
Turtle.java
Turtles.java
I opened turtlesolution
as the project, using IntelliJ.我使用 IntelliJ 打开了
turtlesolution
作为项目。 I then opened (by double clicking) Main.java
.然后我打开(通过双击)
Main.java
。 I want to run this.我想运行这个。 I have to
edit configurations
before I run it, it seems.看来我必须在运行之前
edit configurations
。
So I clicked edit configurations
.所以我点击了
edit configurations
。 I clicked JAR application
because this looks like the option.我单击了
JAR application
因为这看起来像是选项。 This is what comes up:这是出现的情况:
Working directory, I set it to point to turtlesolution
.工作目录,我将其设置为指向
turtlesolution
。 What is Path to JAR
?什么是
Path to JAR
? I tried to set it to turtlesolution
but it remains blank.我试图将它设置为
turtlesolution
但它仍然是空白的。 What does Warning, jar file doesn't exist
mean? Warning, jar file doesn't exist
是什么意思?
I can run it from the command line by just doing我可以通过执行从命令行运行它
cd turtlesolution
javac Main.java Turtle.java Turtles.java
cd ../
java turtlesolution/Main
Aapprently it's very easy to figure out.显然,这很容易弄清楚。 I'm in my final year of learning CS in university and apparently it's simple, but I can't figure out how to do it, and it's too simple to teach ...
我在大学学习 CS 的最后一年,显然这很简单,但我不知道该怎么做,而且教起来太简单了......
If you don't have any run configuration in the project, Run button is also disabled.如果项目中没有任何运行配置,则运行按钮也会被禁用。 If you right click in a file with main method, run configuration is created automatically and main class value if prefilled.
如果使用 main 方法在文件中单击鼠标右键,则会自动创建运行配置,并且如果预填充了主类值。 This worked for me for more vist https://intellij-support.jetbrains.com/hc/en-us/community/posts/206811415-Problem-with-Edit-Configurations-
这对我更有效https://intellij-support.jetbrains.com/hc/en-us/community/posts/206811415-Problem-with-Edit-Configurations-
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.