Review your favorite Linux distribution.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 11-09-2004, 11:23 PM   #1
Registered: Sep 2004
Location: bozeman, montana
Distribution: mandrake
Posts: 32

Rep: Reputation: 15
java - how do you input from the command line

i'm kinda perplexed, i've got a project for school where we're supposed to write a driver to allow piped input/output : for ex, driver < inputFile1 > outputFile but for a variety of input files. i can't figure out how to code this without specifically including the input file in the driver. can anyone help?
Old 11-10-2004, 12:02 AM   #2
Registered: Sep 2004
Location: bozeman, montana
Distribution: mandrake
Posts: 32

Original Poster
Rep: Reputation: 15
no worries, got it figured out.
Old 11-10-2004, 06:26 AM   #3
Senior Member
Registered: Jul 2004
Distribution: Ubuntu 7.04
Posts: 1,991

Rep: Reputation: 76
The answer to the question is to use the and System.out streams.

Please post the answers to your questions if you find out what they are; that way other people can benefit from your insight.

Well done on fixing it, though
Old 11-10-2004, 07:29 AM   #4
Senior Member
Registered: Sep 2004
Distribution: FreeBSD 9.1, Kubuntu 12.10
Posts: 3,078

Rep: Reputation: Disabled
I think zeviddalop meant take arguments when calling 'java' to exec the program. If that is the case, it is almost like C++:

class App
public static void main(String[] args)
//all command line arguments are stored in 'args'; just use it like a normal array
//(the exec name isn't given in [0], unlike C++)
Old 11-10-2004, 11:59 AM   #5
Senior Member
Registered: Apr 2003
Location: Costa Rica
Distribution: Kubuntu, Debian, Knoppix
Posts: 2,064
Blog Entries: 1

Rep: Reputation: 90
If i were to read by lines, I would do:
BufferedReader keyboard = new BufferedReader(new InputStreamReader(;


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Hiding password in Java command line program simon_w Programming 2 05-02-2005 06:01 AM
Java GUI via command line sessions? Giles Linux - General 2 09-28-2004 09:03 AM
run java programs from the command line...howto? rmanocha Programming 3 03-06-2004 02:50 AM
calling command line functions in java darthczyz Programming 2 12-09-2003 07:01 AM
Command line arguments to java program Majjj Programming 3 10-23-2003 05:48 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration