如何在IntelliJ IDEA中设置JVM参数? [英] How to set JVM arguments in IntelliJ IDEA?

查看:1082
本文介绍了如何在IntelliJ IDEA中设置JVM参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用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 of Hello World!.

      我们还指定了两个程序参数(在程序参数"下):HelloWorld!.

      We also specify two program arguments (under Program Arguments): Hello and World!.

      单击Apply按钮或OK按钮后,我们可以运行以下程序:

      After clicking either the Apply button or the OK 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆