How to Run Java Program with Arguments in NetBeans

How to Run Java Program with Arguments in NetBeans

  • Blog
  • 1 min read

In this tutorial, you will learn how to run a Java program with arguments in NetBeans.

I am demonstrating the method, in which I feel convenient, and I am using it to pass the parameters to a Java program.

If you know some better method, then please mention it in the comment section below.

Run Java Program with Arguments in NetBeans

  1. In NetBeans, do the right click on the Java program/class in the Java project navigator and then click on the Tools > Open in Terminal, as shown in the below image:
Open terminal in Java.
Illustrating how to open a terminal in Java to a program with arguments. Image by FoxInfotech.
  1. The terminal window will open in the below section of NetBeans.
  2. There you can compile your Java program and run with arguments as shown in the below image:
NetBeans - Terminal
Illustrating how to execute commands in the NetBeans terminal panel. Image by FoxInfotech.

See also: