aspose file tools*
The moose likes Beginning Java and the fly likes getting data from command line. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getting data from command line." Watch "getting data from command line." New topic
Author

getting data from command line.

Branden Bobo
Greenhorn

Joined: Jul 16, 2012
Posts: 15
Is there a simple pre-build class (as of java 7) to read text from the command line?
If not... I wrote my own re-usible helper class... Is this a good approach is there a better way?


p.s. this is my first post on any forum ever so please be nice.
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 561
Are you aware of Scanner? You can also find many examples of how to use Scanner to do what I think you're trying to do, but I may not understand your question.

Two of the many cool things about Java is that the Core Java API is so rich and that there are many third party libraries that do most anything else the core libraries do not do, or, in some cases, do the same thing only better. I'll relay what I was told early in my Java study, "Don't reinvent the wheel." Instead, I suggest you learn from the inventors who've blazed the trails.


Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Branden Bobo
Greenhorn

Joined: Jul 16, 2012
Posts: 15
Thank you I was not familiar with the Scanner class.
I'm coming from C# so although I've been able to pick the java language quickly,
but I know very little about most of the libraries (of coarse i'm trying to change that.)
Randall Twede
Ranch Hand

Joined: Oct 21, 2000
Posts: 4347
    
    2

don't feel bad. i have several years of java experience, but it was before Scanner class. i have to learn about it too.


SCJP
Visit my download page
Greg Brannon
Bartender

Joined: Oct 24, 2010
Posts: 561
That's cool. Just ask if you have similar, "How do I . . .?" questions. Most basic Java tutorials/books will introduce you to the fundamental classes. Some free books and cheat sheets are available online from which you could quickly cross reference your existing programming knowledge by scanning the reference's Table of Contents.

You should also be aware of the online Java Tutorials that usually come up if you Google a Java topic. For example, if you Google "java input" the first result is the Java Basic I/O Tutorial that covers many I/O topics, including Scanner.
 
 
subject: getting data from command line.