About 865,000 results
Open links in new tab
  1. java - Eclipse : how we take arguments for main when run - Stack Overflow

    Right click the class. Then go to Run as > Run configurations. Select the program on the left side. Then on the arguments tab you will see Program Arguments. Enter your program arguments in this textarea, if you would like to pass multiple arguments separate the arguments by spaces.

  2. Command Line Arguments in Java - GeeksforGeeks

    Jan 2, 2025 · Java command-line argument is an argument i.e. passed at the time of running the Java program. In Java, the command line arguments passed from the console can be received in the Java program and they can be used as input.

  3. java - run programs with an argument? - Stack Overflow

    Apr 26, 2011 · The Java main method has a parameter String[] args which will contain any command line arguments passed. So, in your case, the PrintMe class's main method would look something like: public static void main(String[] args) { for(String s : …

  4. Passing arguments in main method in java class - Stack Overflow

    Nov 22, 2010 · Bear in mind that the main method is a static method, which means that it does not require an instance of the class Test to be called. This is not the case for the run method. run is an instance method, and to invoke it you need an instance of …

  5. Command-Line Arguments in Java - Baeldung

    Feb 20, 2025 · In this short tutorial, we’ll explore how can we handle command-line arguments in Java. 2. Accessing Command-Line Arguments in Java. Since the main method is the entry point of a Java application, the JVM passes the command-line arguments through its arguments. The traditional way is to use a String array: // handle arguments .

  6. How to pass arguments when running a Java program in Eclipse

    Aug 7, 2019 · In this Eclipse and Java tutorial, we show you the steps to pass arguments when running a Java program. Suppose that we have a program which can be executed in two modes console and GUI. Here’s its code: This program accepts one argument. If it is “console”, a console version will be invoked:

  7. Java main() Method – public static void main(String[] args)

    Apr 11, 2025 · Java’s main () method is the starting point from where the JVM starts the execution of a Java program. JVM will not execute the code if the program is missing the main method. Hence, it is one of the most important methods of Java, and having a …

  8. Java Command-Line Arguments - Programiz

    In this tutorial, we will learn about the Java command-line arguments with the help of examples. The command-line arguments in Java allow us to pass arguments during the execution of the program.

  9. How to Pass Arguments to the Main Method in Eclipse

    Right-click on the Java file containing the main method and select 'Run As' > 'Run Configurations...'. Enter your desired arguments in the 'Program Arguments' section, separating multiple arguments with spaces. Click 'Apply' and then 'Run' to launch the program with the specified arguments.

  10. Invoking Java main method with parameters from Eclipse

    Dec 17, 2008 · During development (and for debugging) it is very useful to run a Java class' public static void main (String [] argv) method directly from inside Eclipse (using the Run As context menu). Is there a similarily quick way to specify command line parameters for the run?

  11. Some results have been removed
Refresh