How to set a run/debug configuration in IntelliJ IDEA using a Jar file?

后端 未结 1 669
时光取名叫无心
时光取名叫无心 2021-01-02 09:41

Thanks for welcoming me to the community!

I\'d like to get some help regarding Run/Debug configuration in IntelliJ IDEA. We use a .jar file and I need to setup a run

1条回答
  •  孤街浪徒
    2021-01-02 10:41

    Welcome Manan! You should be able to create a target for the jar application in IntelliJ by following these steps.

    EDIT: Upon initially reading your question I didn't see you already had the steps for creating a new jar configuration, but I'll leave the images here for future readers.

    First, open your run/debug configurations in the top right:

    Then create a new configuration with the plus:

    Enter the appropriate information for the jar. I've edited and shown what you should use. (Comments aren't valid and for demonstration)

    You can run or debug the configuration by selecting from the dropdown and selecting the required button. ctrl-d debugs and ctrl-r runs by default.

    To expand upon what you should enter for the fields (see the image above for your exact configuration):

    • Path to jar: This is the file path of your jar. Notice how you can use the dots on the right to locate it easily.
    • VM options: These are the options for controlling the JVM. For example, the -Xmx1200m sets the maximum RAM of the JVM. I tested what I showed for your configuration. You can separate them with spaces as you would on the command-line.
    • Program arguments: These are the arguments you would feed to your program if you invoked it via the command-line as java programName arguments.
    • Environment variables can be set with name and value via the three dots on the right and then the plus in the bottom left. For you these would include key=jsse.enableSNIExtension and value=false. I'm pretty confident about removing the D, but may be wrong there. Let me know via your testing if it's wrong.
    • JRE: Leave to default unless desired otherwise.
    • Search sources using module's classpath: If your module is configured correctly you can leave this to Default.
    • Before launch: Activate tool window: You can add other tasks to create cool chains of tasks.

    Note you can directly run your Maven project without creating a jar first, just in case that's what you're doing. Also, the -XX:MaxPermSize=256M appears to be deprecated and using address 30306 caused an error when I tested, but an arbitrary 5005 did work.

    0 讨论(0)
提交回复
热议问题