Java Scratch run configuration
Use the Java Scratch run/debug configuration to run and debug Java scratch files that have the main()
method defined.
Common options
Name | Specify a name for the run configuration to quickly identify it among others when editing or running. |
Allow multiple instances | Allow running multiple instances of this run configuration in parallel. By default, it is disabled, and when you start this configuration while another instance is still running, IntelliJ IDEA suggests stopping the running instance and starting another one. This is helpful when a run configuration consumes a lot of resources and there is no good reason to run multiple instances. |
Store as project file | Save the file with the run configuration settings to share it with other team members. The default location is .idea/runConfigurations. However, if you do not want to share the .idea directory, you can save the configuration to any other directory within the project. By default, it is disabled, and IntelliJ IDEA stores run configuration settings in .idea/workspace.xml. |
Main options
Main class | Specify the name of the Java class from a scratch file that you want to execute (pass to the JRE). |
Path to scratch file | Specify the path to the scratch file. |
VM options | Specify the options to be passed to the Java virtual machine when launching the application, for example, When specifying JVM options, follow these rules:
-Xmx1024m -Dspaces="some arg" -Dmy.prop=\"quoted_value\" -Dfoo=${MY_ENV_VAR} Use code completion in this field: start typing the name of a flag, and the IDE suggests a list of available command line options. This works for The |
Program arguments | Specify a list of arguments to be passed to the application in the format you would use on the command line. Use the same rules as for specifying VM options. |
Working directory | Specify the working directory to be used for running the application. This directory is the starting point for all relative input and output paths. By default, the working directory is the project root. |
Environment variables | Specify environment variables that are necessary for running the application. |
Redirect input from | Read input from the specified text file. The path is relative to the working directory unless you specify an absolute path. Click to use macros. You can also use path variables in this field. |
Use classpath of module | Select the module whose classpath should be used to run the application. |
Add dependencies with “provided” scope to classpath | Add the dependencies with the provided scope to the runtime classpath. |
JRE | Specify the runtime environment that IntelliJ IDEA should use to run the application. By default, IntelliJ IDEA uses the latest available JDK from the module dependencies. |
Shorten command line | Select the method for shortening the command line if the classpath gets too long, or if you have so many VM arguments that they exceed your OS command line length limitation:
|
Before launch
Specify a list of tasks to perform before starting the run configuration. For example, run another configuration, build the necessary artifacts, run some external tool or a web browser, and so on.
Click or press Alt+Insert to add one of the available tasks.
Move tasks in the list using and to change the order in which to perform the tasks. Select a task and click to edit the task. Click to remove the selected task from the list.
Show this page | Show the run configuration settings before actually starting it. |
Activate tool window | Depending on the type of configuration, open the Run, Debug, or Services tool window when you start this run configuration. If this option is disabled, you can open the tool window manually:
|