Refresh the Maven project in the Maven Projects tool window (Reimport All Maven Projects), if it doesn't help, refer to this answer for diagnostics.

The issue is that your source roots were not configured correctly from the Maven model for some reason and the .java file appears in a plain directory instead of the Source root.

You can tell that by the color of the folders and by the icon of the file.

Answer from CrazyCoder on Stack Overflow
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ run-debug-configuration-maven.html
Run/Debug Configuration: Maven | IntelliJ IDEA Documentation
If you need, specify the environment variables that you want to use in you project. The following default options are enabled, but you can click Modify options to add new options or remove some of the default ones in Add Run Options: Open run/debug tool window when started - automatically opens the Run/Debug tool window when the configuration is executed and several debugger options ยท Maven Options - lists the default Maven options inherited from the Maven settings.
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 360003337659-How-to-add-Maven-RunConfiguration
How to add Maven RunConfiguration โ€“ IDEs Support (IntelliJ Platform) | JetBrains
So we though about an intellij idea plugin which reads the nbactions-file on project-load and create maven run configurations in intellij. ... RunnerAndConfigurationSettings runnerAndConfigurationSettings = RunManager.getInstance(project).createConfiguration("Test", ConfigurationTypeUtil.findConfigurationType("MavenRunConfiguration").getConfigurationFactories()[0]); RunManager.getInstance(project).addConfiguration(configuration,true); the run configuration is created, but I can't find a description how to set working directory, command-line and profiles in the create run configuration api.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ work-with-maven-goals.html
Maven goals | IntelliJ IDEA Documentation
April 10, 2025 - In the Maven tool window, click Lifecycle to open a list of Maven goals. Right-click the desired goal and from the context menu select Run 'name of the goal'. IntelliJ IDEA runs the specified goal and adds it to the Run Configurations node.
๐ŸŒ
O'Reilly
oreilly.com โ€บ library โ€บ view โ€บ intellij-idea-essentials โ€บ 9781784396930 โ€บ ch06s03.html
Running Maven goals - IntelliJ IDEA Essentials [Book]
To run the selected goal, expand the Lifecycle branch in the Maven tool window and choose Run Maven Build from the context menu, as shown in the following screenshot: If you choose Create from the context menu, the permanent run configuration ...
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 360010630320-How-to-run-Java-project-with-Maven
How to run Java project with Maven? โ€“ IDEs Support (IntelliJ Platform) | JetBrains
April 3, 2021 - I'm trying to use IntelliJ (latest version) with Java and Maven. Without Maven I would define Run/Debug configuration and use it to run and debug my Java SE application. It works perfectly. With Maven and multi-modules I can clean, install, package etc my application.
Find elsewhere
๐ŸŒ
JetBrains
intellij-support.jetbrains.com โ€บ hc โ€บ en-us โ€บ community โ€บ posts โ€บ 16538327137298-Maven-run-configuration-ignores-JRE-setting
Maven run configuration ignores JRE setting โ€“ IDEs Support (IntelliJ Platform) | JetBrains
January 22, 2024 - Settings / Preferences โ†’ Build, Execution, Deployment โ†’ Build Tools โ†’ Maven โ†’ Runner ยท and, if possible, the Project itself for further investigation?
๐ŸŒ
Packtpub
subscription.packtpub.com โ€บ book โ€บ programming โ€บ 9781784396930 โ€บ 6 โ€บ ch06lvl1sec35 โ€บ running-maven-goals
6. Building Your Project | IntelliJ IDEA Essentials
To run the selected goal, expand the Lifecycle branch in the Maven tool window and choose Run Maven Build from the context menu, as shown in the following screenshot:
๐ŸŒ
Stack Overflow
stackoverflow.com โ€บ questions โ€บ 58352214 โ€บ how-to-make-a-run-configuration-in-maven-pom-xml
intellij idea - How to make a run configuration in maven pom.xml - Stack Overflow
Every time i make a git clone i must set up the run configuration. Open "edit run configuration" in Intellij Idea. Choose maven - console - tomcat7:run, name - Run. How to put it into a pom.xml to ...
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ delegate-build-and-run-actions-to-maven.html
Maven projects | IntelliJ IDEA Documentation
Alternatively, from the main menu, select File | Settings | Build, Execution, Deployment |Build Tools | Maven. Click Maven and from the list, select Runner. On the Runner page, select Delegate IDE build/run actions to Maven.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ run-debug-configuration-java-application.html
Run/debug configuration: Application | IntelliJ IDEA Documentation
November 11, 2024 - Application is the most basic run/debug configuration template for Java applications. This configuration compiles and runs your Java program โ€“ similar to when you use the javac and java commands. ยท In the main menu, go to Run | Edit Configurations
Top answer
1 of 1
17

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.

๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ maven-runner.html
Maven. Runner | IntelliJ IDEA Documentation
Use this page to configure settings for the external Maven that will be used to run goals.
๐ŸŒ
JetBrains
jetbrains.com โ€บ help โ€บ idea โ€บ run-debug-configurations-dialog.html
Run/debug configurations dialog | IntelliJ IDEA Documentation
February 24, 2026 - Use this dialog to create, edit, adjust, or remove run/debug configurations, as well as to configure the default templates that will apply to all newly created run/debug configurations ยท Existing run/debug configurations are grouped by configuration types. The templates for creating new ...