Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Redirecting output at command line.

  1. #1
    Junior Member
    Join Date
    Oct 2013
    Location
    Chandler, Arizona, USA
    Posts
    25
    My Mood
    Devilish
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Default Redirecting output at command line.

    This should be easy, but it does not seem to be working . . .

    All I want to do is output the help info to a file, and I am attempting to do it on the command line like this:

    javac -help > com.txt

    However, even though it generates the com.txt file, it is empty.

    This is on a Windows 7 system.

    Any suggestions?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Redirecting output at command line.

    That looks like a problem using an OS. Have you tried asking the question on a forum for the OS you are using?
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    Skywola (October 26th, 2013)

  4. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,520
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: Redirecting output at command line.

    The Bash command for what you're trying to do is:

    javac -help 2> file.txt

    because you're actually redirecting the stderr in this case.

  5. The Following User Says Thank You to GregBrannon For This Useful Post:

    Skywola (October 26th, 2013)

  6. #4
    Junior Member
    Join Date
    Oct 2013
    Location
    Chandler, Arizona, USA
    Posts
    25
    My Mood
    Devilish
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Default Re: Redirecting output at command line.

    Thanks Greg and Norm . . . your right, I should have mentioned it is for Windows 7 . . . I'll edit the original message, thanks!
    I do not see any OS forums here on this site. I use CentOS too, but I am not using it in this case.

    In the end, I found that it was easier just to right-click, select all, then go to the upper
    left hand corner of the window and select "copy", then paste it into a file . . . .

    It appears that when you adjust the Java environment to run the java and javac commands anywhere
    on the command prompt, it then goes into the java mode, and cannot execute a dos-type command
    such as >java -help > test.txt

    So be it, I have better things to spend my time on.

Similar Threads

  1. sdtin/command-line
    By TorontoJava1984 in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: October 16th, 2011, 01:51 PM
  2. Replies: 10
    Last Post: September 16th, 2011, 07:49 PM
  3. command line arguments
    By rizla in forum Member Introductions
    Replies: 3
    Last Post: December 12th, 2010, 11:14 PM
  4. A problem with command line compilation
    By goodguy in forum Java Theory & Questions
    Replies: 4
    Last Post: August 2nd, 2010, 10:58 AM
  5. [SOLVED] Command Line Argument Help
    By EmSaint in forum Loops & Control Statements
    Replies: 2
    Last Post: January 28th, 2010, 10:55 AM

Tags for this Thread