Issue
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 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.
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 my-sample-jar.jar -gui
Here's what I see in my IntelliJ window :
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!
Solution
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.
Answered By - Matt Goodrich
Answer Checked By - Terry (JavaFixing Volunteer)