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

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

问题描述

我对使用 Kinesis Video Stream 时的说明感到困惑

I am confused about the instruction when using Kinesis Video Stream

在 ./src/main/demo 中运行 DemoAppMain.java 并将 JVM 参数设置为

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?

推荐答案

Intellij 允许您在运行 Java 程序时指定两种类型的参数:

Intellij allows you to specify two types of arguments when running a Java program:

  • 虚拟机选项
    • 使您能够修改 JVM 的属性,包括堆栈/堆内存分配、系统属性、GC 标志等.
    • 此处输入的值会在程序开始时传递到主方法的 String[] 参数中.

    在上图中,我们指定了一个名为 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天全站免登陆