如何在IntelliJ IDEA中设置JVM参数? [英] How to set JVM arguments in IntelliJ IDEA?
问题描述
我对使用Kinesis Video Stream时的指令感到困惑
I am confused about the instruction when using Kinesis Video Stream
在JVM参数设置为./src/main/demo中运行DemoAppMain.java
Run DemoAppMain.java in ./src/main/demo with JVM arguments set to
-Daws.accessKeyId={YourAwsAccessKey} -Daws.secretKey={YourAwsSecretKey} -Djava.library.path={NativeLibraryPath}
用于非临时AWS凭证.
for non-temporary AWS credential.
如何在IntelliJ IDEA中设置这些参数?
How to set these arguments in IntelliJ IDEA?
我遵循了文档,找到了运行/调试配置",不知道下一步该怎么做.
I followed the documentation and found the "Run/Debug Configurations" and don't know what to do next.
有帮助吗?
谢谢!
Any help?
Thanks!
推荐答案
Intellij允许您在运行Java程序时指定两种类型的参数:
Intellij allows you to specify two types of arguments when running a Java program:
- VM选项
- 使您能够修改JVM的属性,包括堆栈/堆内存分配,系统属性,GC标志等.
- VM Options
- Enables you to modify attributes of the JVM, including stack/heap memory allocation, system properties, GC flags, etc.
- 在程序启动时,在此处输入的值将传递到主方法的
String[]
参数中.
- Values entered here are passed into the
String[]
parameter of your main method when the program begins.
在上图中,我们指定了名为
example
的单个系统属性(在VM Options下),该属性的值为Hello World!
.In the above image, we specify a single system property (under VM Options) named
example
that has a value ofHello World!
.我们还指定了两个程序参数(在程序参数"下):
Hello
和World!
.We also specify two program arguments (under Program Arguments):
Hello
andWorld!
.单击
Apply
按钮或OK
按钮后,我们可以运行以下程序:After clicking either the
Apply
button or theOK
button, we can run the following program:public static void main(String[] args) { System.out.println(System.getProperty("example")); System.out.println(args[0] + " " + args[1]); }
该程序的输出如下:
Hello World! Hello World!
To create a Run/Debug Configuration, see: Create and Edit Run/Debug Configurations
这篇关于如何在IntelliJ IDEA中设置JVM参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!