Run jar configuration in IntelliJ IDEA

2020-05-27 09:25发布

问题:

Is there any option in IntelliJ IDEA to create a configuration to run an external jar like the external tools configurations in Eclipse?

回答1:

IDEA does not have a dedicated "Executable JAR" run/debug configuration. It does sound like a nice new feature. I'd recommend you request it: http://youtrack.jetbrains.com

Despite that, there are two options to run an executable JAR.

OPTION 1

You can define a normal application run/debug configuration and define the executable JAR via the VM options. Here's an example:

OPTION 2

You can create an "External Tool" definition via File > Settings > [IDE Settings] > External Tools. (Click the Help button in the dialog for details on the fields). You can run it via the Tools menu, or by assigning it a keyboard shortcut in the Keymap settings. The one downside here is that External Tools are defined at the IDE level and not a Project level. So that definition will show for all Projects. However, using the "Groups" option in the External Tools to group all configurations for a Project can add some structure.