如何使用Jar文件在IntelliJ IDEA中设置运行/调试配置? [英] How to set a run/debug configuration in IntelliJ IDEA using a Jar file?

查看:5423
本文介绍了如何使用Jar文件在IntelliJ IDEA中设置运行/调试配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

感谢您欢迎我加入社区!

Thanks for welcoming me to the community!

我想获得有关IntelliJ IDEA中运行/调试配置的一些帮助。我们使用.jar文件,我需要在IDE中设置运行配置。我转到运行>编辑配置> JAR应用程序,然后弹出各种选项。
我有.jar文件,但希望知道需要在哪些字段中设置哪些属性。我们使用.bat文件来启动.jar,我在下面发布相同的内容。

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 configuration in my IDE. I go to Run>Edit Configurations>JAR Application and then the various options pop up. I have the .jar file but wish to know which properties need to be set in which fields. We use a .bat file to startup the .jar and I'm posting the same below.

有人可以查看start.bat文件并告诉我我的内容需要输入我的运行/调试选项?

Could someone please look at the start.bat file and tell me what I need to be feeding into my Run/Debug options?

java -Djsse.enableSNIExtension=false -Xmx1200m -XX:MaxPermSize=256M  -agentlib:jdwp=transport=dt_socket,server=y,address=30306,suspend=n -jar mac-quickstart-2.0.jar -gui

这是我在IntelliJ窗口中看到的内容:

Here's what I see in my IntelliJ window :

此外,我使用Maven在IntelliJ中构建项目(通过导入.pom文件)。
感谢您的宝贵意见,期待在此做出贡献!

Besides, I used Maven to build up the project in IntelliJ (by importing the .pom file). Appreciate your valuable feedback, looking forward to contributing here!

推荐答案

欢迎马南!您应该能够通过以下步骤在IntelliJ中为jar应用程序创建目标。

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


编辑:在最初阅读您的问题后,我没有看到你已经
有创建新jar配置的步骤,但我会留下
图片给未来的读者。

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:

输入jar的相应信息。我编辑并展示了你应该使用的东西。 (评论无效且用于演示)

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

您可以通过从下拉列表中选择并选择所需按钮来运行或调试配置。 ctrl-d debugs和ctrl-r默认运行。

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):


  • jar的路径:这是jar的文件路径。请注意如何使用右侧的点来轻松找到它。

  • VM选项:这些是用于控制JVM的选项。例如, -Xmx1200m 设置JVM的最大RAM。我测试了我为你的配置显示的内容。您可以像在命令行上一样用空格分隔它们。

  • 程序参数:如果您通过命令行调用它,那么这些参数将提供给您的程序 java programName参数

  • 环境变量可以通过右边的三个点设置名称和值,然后是底部的加号剩下。对你来说,这些包括key = jsse.enableSNIExtension和value = false。我对移除D非常有信心,但可能是错误的。如果错误,请通过您的测试告诉我。

  • JRE:除非另有要求,否则保留默认值。

  • 使用模块的类路径搜索源:如果您的模块配置正确您可以将其保留为默认

  • 启动前:激活工具窗口:您可以添加其他任务来创建酷链任务。

  • 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.

注意你可以直接运行你的Maven项目而不先创建一个jar,以防你正在做的事情。此外, -XX:MaxPermSize = 256M 似乎已被弃用,并且在我测试时使用地址 30306 导致错误,但任意 5005 确实有效。

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.

这篇关于如何使用Jar文件在IntelliJ IDEA中设置运行/调试配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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