How to invoke method of a library from command line

How to invoke method of a library from command line

Suppose there are two methods in a libray and you have to invoke one of the method from that library directly from the command prompt.

How will you do it?

View Answers

January 6, 2012 at 1:32 PM

import java.util.*;
class JavaMethod 
{
    public static void main(String[] args){
        Scanner input=new Scanner(System.in);
        System.out.print("Enter Number1: ");
        int num1=input.nextInt();
        System.out.print("Enter Number2: ");
        int num2=input.nextInt();
        int  maximum=Math.max(num1,num2);
        System.out.println("Largest is: "+maximum);
    }
}

January 6, 2012 at 3:17 PM

This is not exactly what am I looking for.

Here you are invoking the method with in the code, not from the command prompt directly.

Here just the two numbers are read from command prompt only, nothing specific to invoking method from Command prompt.

Same we can use with args of main method. Based on the the type of input we can invoke the method from code.

My concern is that is there any way to invoke method of library directly from Command Prompt?









Related Tutorials/Questions & Answers:
How to invoke method of a library from command line
How to invoke method of a library from command line  Suppose there are two methods in a libray and you have to invoke one of the method from that library directly from the command prompt. How will you do
How to run PHP Script from the command line ?
How to run PHP Script from the command line ?  Running PHP Script from the command line   Actually it is very simple to run php script command line. Except there are a few things that are different, for example
Advertisements
How to Check Markup in PHP File from Command Line
How to Check Markup in PHP File from Command Line  Check Markup in PHP File from Command Line   PHP has a feature that allowed you to check... try this: http://www.phpzag.com/check-markup-in-php-file-from-command-line
How to Checking Syntax Error in PHP from Command Line
How to Checking Syntax Error in PHP from Command Line  Checking Syntax Error in PHP from Command Line   PHP allows you to check your script... check this: http://www.phpzag.com/checking-syntax-error-in-php-from-command-line
How To Read String From Command Line In Java
How To Read String From Command Line In Java In this section we will discuss about how string can be read through the command line. In Java command line... This example demonstrates that how to take input from command line. Here
How To Read Integer From Command Line In Java
How To Read Integer From Command Line In Java In this section we will discuss about how an integer can be read through the command line. In Java all... to take integer value from the command line. In this example I have created
Java memory options from command line
Java memory options from command line  Hi, How to use java memory options from command line? Thanks   Hi, Here is the example code: java -Xms1056m -Xmx1056m MyProgram Thanks
Repairing mysql database from command line
Repairing mysql database from command line  Hi, Can anyone tell me the process for repairing mysql database from command line? Thanks
Java I/O From the Command Line
Java I/O From the Command Line In this section we will learn about the I/O from the command line in Java. Several times you can see that the programs runs after taking the input from the command line. Java also supports for the command
How To Unblock IP address from command line in CSF Firewall ââ?¬â?? Linux Server?
How To Unblock IP address from command line in CSF Firewall ΓΆβ?¬β?? Linux Server?  Hi, How To Unblock IP address from command line in CSF Firewall... /etc/csf/csf.deny using vi editor. Command is: vi /etc/csf/csf.deny Remove
Running R script from command line
is very important. How to run run R Script from command line? To run the R...Steps of running R script from command line In the previous tutorial we... will create a file for R script and then run this script from command line
Compiling and Running Java program from command line
Compiling and Running Java program from command line - Video tutorial... of compiling and running java program from command line. We have also video... of the Compiling and Running Java program from command line: View more tutorials
Run PySpark script from command line
Run PySpark script from command line - Run Hello World Program from command... have successfully executed your program from command line. If your job is long...: In this tutorial you learned to Run PySpark script from command line. ADS_TO_REPLACE_5
PHP invoke Method
functions. __invoke() is one of them. The functionality of __invoke() method... of __invoke() method it is possible and just because of it's magical property..._TO_REPLACE_1 PHP Invoke Method Example: <?php class AADS_TO_REPLACE_2 { public
how to pass command line arguments in ant
how to pass command line arguments in ant  How to pass runtime values ie commandline arguments to a program written in java using ant tool
How to pass command line arguments in Java?
How to pass command line arguments in Java?  Hi, In a Java program I have to write for reading the command line arguments and use it in a programming. How to pass command line arguments in Java? Share me the sample code
How to check CentOS version via command line?
How to check CentOS version via command line?  Hi, I have a linux... system installed on it. How to check CentOS version via command line? Thanks.... You can find the CentOS version installed with the help of following command: cat
Passing argument at command line using Core Java
How to pass Command Line Argument using Core Java Description : This example demonstrate how value accepted from the command line. All argument need to placed at the command line at the time of executing your program.  class
PHP Invoke Method
__invoke(): PHP 5.3.0 has introduced lots of new methods,  __invoke() is one of them. The purpose of __invoke() method is different from others..., let's try to evaluate what is it actually and how it works? Hope
How can I execute a PHP script using command line?
How can I execute a PHP script using command line?  How can I execute a PHP script using command line
How do I install a .deb file via the command line?
How do I install a .deb file via the command line?  How do I install a .deb file via the command line?   Hi, You can install it with following command: sudo dpkg -i DEB_PACKAGE Example: sudo dpkg -i packagename.deb
Java Command Line Input
Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line System.out.println("Please Input A Number"); BufferedReader br
Command line arguments
Command line arguments  Please explain me what is the use of "command line arguments" and why we need to use
Compiling package in command line
Compiling package in command line  Hi friends, i am totally new to java programming, i am basic learner in java. My query is, How to compile java package using command line. For Eg: When i compile following command, c:>set
character as command line arguments
character as command line arguments  public class testing { public static void main(String args[]) { char a; a=args[0]; System.out.println("character is:"+a); } } what will be the above program output
COMMAND LINE ARGUMENTS
COMMAND LINE ARGUMENTS  JAVA PROGRAM TO ACCEPT 5 COMMAND LINE ARGUMENTS AND FIND THE SUM OF THAT FIVE.ALSO FIND OUT LARGEST AMONG THAT 5   Hi Friend, Try the following code: import java.util.*; class
How to read a line from a doc file
How to read a line from a doc file  How to read a line from a doc file   Hi Friend, To run the following code, you need to download POI library.ADS_TO_REPLACE_1 import java.io.*; import
Java Command Line Argument Example
Java Command Line Argument Example In this section we will read about how... will demonstrate you about how the command line argument can be provided... all the arguments given from the command line at the console
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application
How to invoke other java class by selecting from dropdown menu and subsequently clicking button in java swing application  Hello Sir, first of all... submit button should show the user various textfields on the same panel from
How to Invoke method using Reflection API of Java?
;concat", parametertype); Step 3: Now we have to call the invoke method... how to call the "append" method of StringBuffer class using the Java...); // Invoke the append method method.invoke(stringBuffer, " Hello
I invoke the ResultSet methods afterLast and beforeFirst when the method next works.
I invoke the ResultSet methods afterLast and beforeFirst when the method next works.  Why can't I invoke the ResultSet methods afterLast and beforeFirst when the method next works
What is command line argument in Java
of arguments from the command line. Arguments are passed as a string array...What is command line argument in Java  What is command line argument... example of command line argument program in Java?? It will be really helpful
Command Line Arguments in Java Program
directly from the command line. The user can enter command-line arguments when invoking the application. When running the java program from java command... Command Line Arguments in Java Program   
How to call the run method from another class?
How to call the run method from another class?  Sorry, if this is a stupid question. I would like to find out how to call the run method... run() { new FereastraPrincipala().setVisible(true); from the class
Invoke Method in Java
Invoke Method in Java     ... in the program to invoke the methods. As you can see here we are using reflect method... will show you, how to declare and invoke the methods in Java.  ADS
ModuleNotFoundError: No module named 'command-line'
'command-line' How to remove the ModuleNotFoundError: No module named '... environment you have to install padas library. You can install command-line python... of command-line python library, ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'command-line'
'command-line' How to remove the ModuleNotFoundError: No module named '... environment you have to install padas library. You can install command-line python... of command-line python library, ModuleNotFoundError: No module named '
Passing Command Line Arguments
pass values on command line argument . We are taking a sequence of character from command line at run time. Store these strings into an array... Passing Command Line Arguments     
execute a PHP script using command line
execute a PHP script using command line  How can I execute a PHP script using command line?   Hi friends, Just run the PHP CLI (Command Line Interface) program and provide the PHP script file name as the command line
command line arguments - Java Beginners
command line arguments  how can i findout the minimum and maximum no's at the command prompt if i give some values?????????  hi friend... at the command prompt and then calculate the max and min numbers from them
How to connect to MySQL from command prompt?
How to connect to MySQL from command prompt? This video tutorial walks you... tutorial of: "How to connect to MySQL from command prompt?"ADS... learned How to connect to MySQL database from command prompt. Check all
How to extract the entire line with specific data from a Text in java?
How to extract the entire line with specific data from a Text in java?  Hi, i would like to extract data from text like the following one: [CODE... my prog? i know how to read specific line from text with the lineNumber
How to check if ZooKeeper is running or up from command prompt
How to check if ZooKeeper is running or up from command prompt  Hi, I want to see if the ZooKeeper is running or not on my Hadoop cluster. How to check if ZooKeeper is running or up from command prompt? Thanks   Hi
pyspark: line 45: python: command not found
Spark Error: pyspark: line 45: python: command not found I installed Spark...:~/Spark.2.4.5Tutorial/spark-2.4.5-bin-hadoop2.7/bin$ ./pyspark ./pyspark: line 45: python: command not found... --version command from terminal. Now we are all set. You can test the pyspark
how many ways are there to invoke a servlet object?
how many ways are there to invoke a servlet object?  how many ways are there to invoke a servlet object
How can i read a file from nth line onwards in java
How can i read a file from nth line onwards in java  Hi, I need to read a file content from its nth line onwards till end. How can i implement it in java. Regards, Chinnu
How to extract a specific line from a text file? - IoC
How to extract a specific line from a text file?  Hi all, i'm trying to write a code that return a specific line from a text file. so my first..., it's working fine and it's from Roseindia tutorial. But now, i want to extract the line N
Command line arguments
Java application can accept any number of arguments directly from the command line. The user can enter command-line arguments when invoking the application. When running the java program from java command, the arguments are provided

Ads