How to Get Input from Command Prompt?
How can i get input from command prompt like
C:\
or linux ?
(Here's what I use now)
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
String line;
Whlie((line=in.readLine())!= null)
{ System.out.prinln( line) ; }
IS THERE A BETTER WAY?
The main method within a java class accepts command line input through a String array.
In this example args is the String array. You can access the parameters as args[0] for the first parameter, args[1] for the second parameter, etc....
The usage for the example below would be :
c:\EDIFormat file1 file2
Where args[0] would equal file1 and args[1] would equal file2.
public class EDIFormat {
public static void main(String[] args) {
if (args.length < 0) {
System.out.println("No Parameters supplied. Exiting....");
// open input and output files
EDIFiles(args[0], args[1]);
Hope that helps!
Similar Messages
-
How to get input from card reader
hi, everyone,
I have a project, which needs me to get input from card reader. My terminal input is IBM POS system, but it didnot provide the API to get the input. How can I get the input? Need your help so much! and thanks a lotNow this is a wild idea.... how about searching the IBM site for technical information ?
-
How to run form from command prompt
Hi,
How to run a form from command prompt
can anybody suggest me the way
prasanth a.s.Well, if you are running windows, client server forms 6i, and your form is called 'myform', you could put this into a batch file :-
start ifrun60 module=myform -
How to get input from keyboard scanner into an array
This is probably a very basic question but I'm very new to java..
My task is to reverse a string of five digits which have been entered using keyboard scanner.
E.g. - Entered number - 45896
Output - 69854
I used the StringBuffer(inputString).reverse() command for this, but i need a more basic method to do this.
I thought of defining an array of 5
int[] array = new int [5];
and then using,
Scanner scan = new Scanner(System.in);
to enter the numbers. But I can't figure out how to get the five input numbers into the array.
If I can do this I can print the array in reverse order to get my result.
Any other simple method is also welcome.Hey thanks for the quick reply,
But how can I assign the whole five digit number into the array at once without asking to enter numbers separately?
E.g. - if entered number is 65789
Assign digits into positions,
anArray [0] = 6;
anArray [1] = 5;
anArray [2] = 7;
anArray [3] = 8;
anArray [4] = 9;
I'm really sorry but I am very new to the whole subject. -
How to Get input from User and Display it's Value
Hi ,
I need to get 2 inputs from user and to display it's Mutilple Value.
The Below Code is working fine to get 2 Input's from user,but it display a Junk value as a Result .How to
overcome this Problem. I need to display it's Mutilple(a*b) value of "a " and " b".
import java.io.*;
class Mul{
static int a=0;
static int b=0;
static int Count=0;
public static void main(String args[])throws IOException{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
do{
a=(char)br.read();
Count++;
b=(char)br.read();
if(Count==2)
System.out.println("The Multiplied Value is "+a*b);
}while(Count<2);
}Changed to Integer but still the problem persists.
import java.io.*;
class Mul{
static int a=0;
static int b=0;
static int Count=0;
public static void main(String args[])throws IOException{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
do{
a=(int)br.read();
Count++;
b=(int)br.read();
if(Count==2)
System.out.println("The Multiplied Value is "+a*b);
}while(Count<2);
} -
How to Get Input From User and Display Result
Hi ,
I need to get 2 inputs from user and to display it's Mutilple Value.
The Below Code is working fine to get 2 Input's from user,but it display a Junk value as a Result .How to
overcome this Problem. I need to display it's Mutilple(a*b) value of "a " and " b".
import java.io.*;
class Mul{
static int a=0;
static int b=0;
static int Count=0;
public static void main(String args[])throws IOException{
BufferedReader br =new BufferedReader(new InputStreamReader(System.in));
do{
a=(char)br.read();
Count++;
b=(char)br.read();
if(Count==2)
System.out.println("The Multiplied Value is "+a*b);
}while(Count<2);
}Hi ,
I need to get 2 inputs from user and to display it's
Mutilple Value.
The Below Code is working fine to get 2 Input's from
user,but it display a Junk value as a Result .How
to
overcome this Problem. I need to display it's
Mutilple(a*b) value of "a " and " b".
import java.io.*;
class Mul{
static int a=0;
static int b=0;
static int Count=0;
public static void main(String args[])throws
IOException{
BufferedReader br =new BufferedReader(new
InputStreamReader(System.in));
do{
a=(char)br.read();This line will get you the ascii-value of the typed character.
This line will not get you the value typed in.
Try looking for Integer.parseInt()...
Count++;
b=(char)br.read();
if(Count==2)
System.out.println("The Multiplied Value is "+a*b);
}while(Count<2); -
JComboBox How to get input from JComboBox
Hi all.
I have a JComboBox called combobox.
User can choose one string out of 5 using this JComboBox.
Whenever the user press a button, I'd like to get an input through this combobox using actionListener.
How can I get input through JComboBox?
combobox.getValue() ???
I appreciate your help !http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JComboBox.html
Object getSelectedItem() -
How to get input from BARCODE Reader
using oracle forms builder...........in form text box
Yes I actually used such a reader way back with forms 2.0.
It connects into the keyboard lead so as far as the form is concerned it is exactly the same as typed input. Such readers can also be programmed to send a <return> at the end of the string to fire validation and move to the next field. The keyboard emulation method is also ideal when an unreadable barcode is encountered as the operator can just take over and type it in manually. -
How can i get input from user in Workflows
Hello professionals,
I'm new to SAP B1 Workflow, i have created some workflows and they all worked fine.
But, I am wondering, How can i get input from user?. For example, i want to display list of options to choose between them and route the workflow based on the selected option. I don't want to use the exclusive gateway and check for some conditions, i want to get input from user.
How can i do that?
Thanks in advance,
Kareem NaguibHi,
Please refer SAP help file:
http://help.sap.com/saphelp_sbo900/helpdata/en/b8/1f9a1197214254b79bcf8f93f9fff9/content.htm?frameset=/en/44/c4c1cd7ca22…
Thanks & Regards,
Nagarajan -
How to search specific text/string in pdf files from command prompt?
Hi,
How to search specific text/string in pdf files from command prompt?
Will be great if you can refer to any adobe provided command base utility to achieve the above target.
Best Regards,You can't. The commandline parameters for Acrobat and Adobe Reader do not allow any type of commands to be run.
-
How do i get input from the user?
For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?
hi,
if you want to get input from your console your should work with io(input and output).The BufferedReader class, InputStreamReader class
you should import "java.io.BufferedReader" and "java.io.InputStreamReader" package, and do something like this:
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String favoriteNumber;
System.out.println("Whats your favorite number ");
favoriteNumber = input.readLine();
System.out.println ("Your favorite Number Is " + favoriteNumber);
if its a gui you should import "javax.swing.JOptionPane" and do the following
String favoriteNumber = JOptionPane.showInputDialog(null, "Enter your favorite Number", "Favorite Number", JOptionPane.INFORMATION_MESSAGE);
anjiie([email protected]). -
How can i add the value inputted from the prompt box to the mysql database?
Hey guyz help me pls with this problem... im only new to javascript and also to the opensource like(php and mysql). I tried to use a prompt box and store the value into the textbox. But now I want to know how to insert/add the value inputted from a prompt box directly into the database if it is possible.
Java is not JavaScript, they've got almost nothing in common (apart from superficial syntax similarities and the first 4 letters of their names).
If indeed your question is about JavaScript, then please find a JavaScript forum, as we can't help you here. -
How to run non-customised report from command prompt to gen trace file?
Hi
how to run non-customised report from command prompt to gen trace file?
EBS R12 RUP6.
RHEL5
rgrdsHi,
See (Note: 285497.1 - Rwrun.sh Does Not Generate Trace Output Using TRACEOPTS in Command Line) and/or (Note: 737445.1 - R12 Concurrent Requests Run Forever; rwrun Errors REP-50125) for the command you need to use.
Thanks,
Hussein -
How to close an app in Win 8.1 phone/emulator from command prompt?
As part of a project, I need to launch and close an app in Win 8.1 phone/emulator from command prompt.
I could launch the app using "AppdeployCmd" tool from Windows SDK .But with that I cannot close the app.Is there any way to do the same??
Thanks in advance. :)Thanks Rashmi for your reply. Is there any other way to do so? Actually I am trying to automate the actions of an app where launching and subsequent exiting of an app is a test case.
No available command to allow you do this, I don't know if OEM have the permission
Best Regards,
Please remember to mark the replies as answers if they help -
Unable to run discoverer report from command prompt
Hi,
I'm trying to run the discoverer report from command prompt and i need to schedule the same.
How could i pass multiple values for the parameters?
If i don't pass the optional parameters, the parameter screen is getting pop-up? How to skip optional parameters?
Also, how to pass the data ranges (format for date parameters) ?
I'm using the below command in command prompt:
cd/d E:\oracle\BIToolsHome_1\bin
dis51usr /connect username/password@database /opendb "TIMS-PCJ status Report" /sheet "TIMS observation status report (based on performed date)" /parameter "Test Number" 40351 /parameter "From Date" "01-JAN-2007" /parameter "To Date" "28-FEB-2007" /parameter "Observation Status" C /parameter "Observation Name" "Abdominal Girth" /export HTML "C:\DISCOVERER_REPORT_SCHEDULING\DIS_OUTPUT\PCJStatusOutput11"
Any one please reply me. Its very urgent.
Regards,
SreedharHi,
How could i pass multiple values for the parameters? You should be able to use a comma separated list e.g.
/parameter "Observation Name" "'Abdominal Girth','Abdominal Girth2'"
How to skip optional parameters?I don't think you can. You have to supply all parameters and then decode out the parameters you don't need in the workbook.
how to pass the data ranges You cannot pass a date range. You can pass a start and end parameters. The default format for the date parameters is DD-MON-YYYY but this can change depending on the NLS settings and format of the data item.
Rod West
Maybe you are looking for
-
Wrong Apple ID: How do I change the Apple ID prompt when Updating All Apps?
How can I change the (wrong) Apple ID from the password prompting dialogue when I am already signed in Apple Store with my own ID? More details of my problem: When I try the Apps' Update-All option in my iPod 4, the password dialogue prompts me with
-
HP smart web printing is incompatible with Firefox 7.0.1
HP smart web printing is incompatible with Firefox 7.0.1 Product name and model number: HP PHotosmart X7280 all in one printer OS : Windows seven 32 bit system
-
Parameters, dropdown list limit
i am using a dropdown list of companies. as part of my parameters to run my report. i think the limit of the dropdown list is 150. how do i make it bigger? i think i have 210 companies... or something like that thanks, Jon
-
Sens interdit au démarrage MacBook pro ?
Mon MacBook pro plante et reste figé sur un écran blanc avec un sens interdit. Je n'arrive à le rebooter, ni même à lancer le DVD d'installation de l'OS... Help .!!! Une astuce ? Merci par avance
-
Can i record straight from my T.V. to my ipod
Hi can i record straight from my tv to my ipod, if so how do i do it if not how can i get things from my telle onto my ipod thanks?????