Console output

Is it possible to align output text to the console?
I'm printing a UI to the console which gives users the ability to select an option
System.out.printf("*********************%n");
System.out.printf("Welcome to the system%n");
System.out.printf("Please select an select an option%n");
System.out.printf("1 - Login with username and password%n");
System.out.printf("2 - Create an account%n");
System.out.printf("3 - Options%n");
System.out.printf("4 - Exit%n");
System.out.printf("*********************%n");
I was wondering if I can format this text to be aligned to a certain side. Or columns if not, but I prefer alignment. Also is there a more efficient way to write a large paragraph to be output(like above)?
Thank you!

double post console output

Similar Messages

  • I want to show console output in my cmd prompt in C# winform application

    Hi,
    I'm launching the some process in C# .net Winform appliaction. But i couldn't able to see console output on the screen. The process is getting launched but inside cmd prompt window, it is showing nothing. I would like to show something on cmd prompt. Please
    help on this.
     using (Process comxdcProcess = new System.Diagnostics.Process())
                            comxdcProcess.StartInfo.FileName = fileName;
                            comxdcProcess.StartInfo.Arguments = args;
                            comxdcProcess.StartInfo.RedirectStandardError = true;
                            comxdcProcess.StartInfo.RedirectStandardOutput = true;
                            comxdcProcess.StartInfo.UseShellExecute = false;
                            comxdcProcess.Start();
                            this.errorComment = comxdcProcess.StandardError.ReadToEnd();
                            StreamReader myStreamReader = comxdcProcess.StandardOutput;
                            //// Read the standard output of the spawned process. 
                            this.errorComment = myStreamReader.ReadToEnd();
                            comxdcProcess.WaitForExit();
    click "Proposed As Answer by" if this post solves your problem or "Vote As Helpful" if a post has been useful to you Happy Programming! Hari

    @Hariprasadbrk
    Do you mean you have use process class to start "cmd prompt" And want to display some output in it?
    If so, there is no need to use RedirectStandardOutput property. This property means the output of an application is written to the
    Process.StandardOutput stream.
    // Setup the process with the ProcessStartInfo class.
    ProcessStartInfo start = new ProcessStartInfo();
    start.FileName = @"C:\7za.exe"; // Specify exe name not cmd exe.
    start.UseShellExecute = false;
    start.RedirectStandardOutput = true;
    // Start the process.
    using (Process process = Process.Start(start))
    // Read in all the text from the process with the StreamReader.
    using (StreamReader reader = process.StandardOutput)
    string result = reader.ReadToEnd();
    Console.Write(result);
    Output
    This section shows the output of the process.
    7-Zip (A) 4.60 beta Copyright (c) 1999-2008 Igor Pavlov 2008-08-19
    Usage: 7za <command> [<switches>...] <archive_name> [<file_names>...]
    [<@listfiles...>]
    So you can start a cmd exe.
    Please also take a look at the article from codeproject
    How to redirect Standard Input/Output of an application
    In summary, the shutdown proces is invoked from my application, and it displays the output from the process in RichTextBox control.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How can i display console outputs in my form?

    Hi,
    <p>I have an application which performs some actions like, insert 200 rows in the database. While inserting data i am using <code>
    int i=0;
    system.out.println ("Insert "+i+" row in database");
    i=i+1;
    </code>
    The output displays on the commnad line.</p>
    <p>what i am trying to do is i have a form, which has text area. I want to display the console output "Insert 1 row in database" and next "Insert 2 row in database"..... and soon in the text area. How could i do that?</p>
    <p>Thanks in advance!!</p>

    Hi Petes,
    Thanks for you response. I am very new to java. I just started learning jsp and have bit knowledge of swing. I am confused how to use jsp and swing componenets together. Can you please guide me a bit?
    Also i am using AJAX to update form field. I am able to work with the rest except bringing the console output in the text area.
    Do you think i have some other way to do it?
    Do you think, it is a good idea , if I will save the output strings in a file and with the help of jsp i can read the file in textarea.
    Pin2g

  • How can i display console outputs in my form field?

    Hi,
    I have an application which performs some actions like, insert 200 rows in the database. While inserting data i am using
    int i=0;
    system.out.println ("Insert "+i+" row in database");
    i=i+1;
    The output displays on the commnad line
    what i am trying to do is i have a form, which has text area. I want to display the console output "Insert 1 row in database" and next "Insert 2 row in database"..... and soon in the text area. How could i do that?
    Thanks in advance!!
    pin2g

    solution removed, because you crossposted.
    Message was edited by:
    Navy_Coder

  • How to print console output

    Hi, I have a JSP page and I would like to print STDOUT to the page. Is this possible?
    I've seen a few methods and none work for me:
    BufferedReader reader = new BufferedReader(System.out);
    String input = reader.readLine();
    out.println(input);*** Error: Type BufferedReader was not found.
    FileOutputStream out;
                    PrintStream ps; // declare a print stream object
                    try {
                     // Create a new file output stream
                    out = new FileOutputStream("myfile.txt");
                            // Connect print stream to the output stream
                            ps = new PrintStream(out);
                            ps.println ("This data is written to a file:");
                System.err.println ("Write successfully");
                            ps.close();
                    catch (Exception e){
                            System.err.println ("Error in writing to file");
                    }*** Error: Duplicate declaration of local variable "out".
    *** Error: The type of the left-hand side in this assignment, "javax/servlet/jsp/JspWriter", is not compatible with the type of the right-hand side expression, "java/io/FileOutputStream".
    *** Error: No match was found for constructor "PrintStream(javax.servlet.jsp.JspWriter)".
    So what's next?
    How can I call the console without writing to a file first?
    I would like AJAX to show console output in real-time.

    Thanks for your help.
    The reason I have the script to write to a file is because it's the closest I could find to what I want. Ideally, I would be able to run a script that prints to the console but I want to grab the system.out going to the console and display it on the page.
    Basically, I want the page to act as a console but not redirect the output (I want it to still go to the console) and I don't want it in a text file that the page reads.
    So for example, the page loads and while that is occurring, the server grabs the console output and prints to the page. Then I run a function on the page that prints to the console and on the refresh, print the updated output. Ideally, I would restrict the output that was relevant to the page's functions and ignore every output to the console but I'm not (trying to be) picky.
    So how would that work?
    Pseudo-code:
    for (int i=0;i < System.out().length(); i++) {
            String grabbedtext += System.out().toString();
    }out.println(grabbedtext);

  • Server console output

    Hi,
    I have been using flex from last six month. I have develped one application and now its time to deploy the application. But, I am facing one issue regarding server console output. In my application I have various remote call to java class deployed on JBOSS server. My problem is that, whenever I made any remote call the information of that remote call gets printed on server console. I want to stop this server console printing. How can I do this? Please suggest. I have checked in my code, there is no trace() or system.out.println() command is used. Please help me out of this. Its very urgent.
    Thanks.
    Regards,
    Ravindar Kumar

    Hi
    You can setup properties so that we can save stdout and stderr to files.
    In the setDomainEnv.cmd file of your domain, you can set the properties so that the ouput will be saved to a file
    %WLS_STDOUT_LOG%
    %WLS_STDERR_LOG%
    Vimala-

  • Create console output from LabView

    Hi all.
    Is there any way of creating a console string output when calling a dll from LabView?
    I have to call a C++ program from LabView and I'm using a dll. I need to debug this program, and I think that using "cout" is the fastest and simplest way.
    Thanks in advance.
    Regards,
    Francisco

    No, there is no console output when calling a DLL. You could have your DLL simply write debug information to a log file.

  • How to see console output in Sun Java(TM) System Web Server 6.1 SP7?

    Dear All,
    I am having Sun Java(TM) System Web Server 6.1 SP7 installed on Windows 2000 Prof.
    I have deployed few applications and they were running successfully.
    From debugging point of view, i like to see the output from System.out.println .
    Prior to SP7 there is a console which shows this output. But now the batch files only starts and stops the admin and site server services. Where to see for console output?
    Is there command like tail.exe of Weblogic awailable for Sun Java System Web Server or any setting to be done in Admin?
    Please revert.
    -Sameer

    Response headers can be found in srvhdrs pblock.
    Those can be manipulated by using set-variable
    http://docs.sun.com/app/docs/doc/820-1638/6nda01tea?l=en&a=view#abuis
    You can read more about these in
    Sun Java System Web Server 6.1 SP8 Administrator's Configuration File Reference
    http://docs.sun.com/app/docs/doc/820-1638?l=en
    and
    Sun Java System Web Server 6.1 SP8 NSAPI Programmer's Guide
    http://docs.sun.com/app/docs/doc/820-1643?l=en

  • Change console output device?

    Hi all,
    I have a laptop that I sometimes connect to a larger monitor.  I would like to be able to change my console output device so that I can connect to my larger monitor on the fly and have my console output switch over-- basically I'm looking for xrandr for the console (xrandr does the job just fine in X11).
    If I initially boot up with my laptop screen closed and my monitor connected, the console output goes to my monitor as desired.  But I would like to be able to switch output devices on the fly, rather than having to reboot to switch console output between my monitor and laptop screen.  Thanks for any help

    just found your post...
    I ask the same here http://bbs.archlinux.org/viewtopic.php?id=68589 without an answer yet, maybe you want to suscribe to mine as i do here in yours

  • Slow console output in new JDEVELOPER

    Hi,
    I have really trivial problem with new versions of JDEVELOPER (e.g. 9.0.3.1035 or
    9.0.3.1 built 1107) - slow console output.
    This OutputTest.java runs approx. 30 seconds !!
    There is no such a problem with e.g. JDEVELOPER 9.0.3.988 Preview. It takes only 0.2 second.
    Is there any workaround ? Can you help me to solve the problem?
    Thanks,
    Fero
    public class OutputTest {
    public static void main(String[] args) {
    for (int i = 0; i &lt; 1000; i++) {
    System.out.println("Very slow output" + i);

    This issue has been fixed for a later release. I don't know of any work around for you, except not writing so much to System.out and System.err.
    -Liz

  • How to set echo of console output  as ' * ' ?

    I've made a bank application in java using console input/output and when the password is typed,it echo the same word as typed.
    So how can i change the echo of console output specially when asking for password ?

    Thankue very much.
    But do me a favour i've jdk 1.5 installed in my system.
    I don't have java.io.Console class file, so will you please send me only that class file or give me link from where i can get that.
    My email address is -
    [email protected]

  • Console output on Solaris 7 and Solaris 8

    Hi All...
    It seems to me strange and impossible, but...
    I load 32-bit driver : add_drv -m '* 0600 root root' <driver_name> on Solaris 7 and 8.
    Both systems are 32-bit. The same source, the same define flags ( I use -D_KERNEL -DSUNDDI ).
    On 8 I can see my driver's console output, on 7 - no way!
    I produce console output using function cmn_err(CE_NOTE, format ...);
    One interesting thing else: after my driver has come in kernel refuses to attach it, so the driver remains unattached. After rem_drv I checked dmesg output, there I saw this :
    NOTICE: <driver name>: 64-bit driver module not found
    What could it be?? Any suggestions are welcome
    Thank you in advance
    Andrew

    Sorry, computer was booted with 64-bits kernel.
    Andrew

  • Console output - way too much info...

    when i debug my application i get loads of the following statements in the console output..
    [SWF] /blah/blah/blah.swf/[[DYNAMIC]]/1 - 172 bytes after decompression
    [SWF] /blah/blah/blah.swf/[[DYNAMIC]]/1 - 121 bytes after decompression
    [SWF] /blah/blah/blah.swf/[[DYNAMIC]]/1 - 172 bytes after decompression
    [SWF] /blah/blah/blah.swf/[[DYNAMIC]]/1 - 121 bytes after decompression
    I am using the flash builder beta 2 plug in with Zend Studio 7 and I have got swfs embedded in mx:image tags.
    Maybe it is an issue with Zend Studio and what it displays in the console...  Maybe it is a setting I don't know about in Flash Builder or it could be the embedded swfs... but if anyone can help i would really appreciate it..
    at the moment there are so many messages it is hard for me to locate my trace statements. blessings..

    still looking for an answer if anyone can help..?

  • Using dtrace to tap into local-zone console output?

    Was wondering if anyone has experimented with dtrace to capture zlogin console output for local zones. (all in the global ofcourse)
    (I don't want to run zlogin and capture its output to a file, since that would interfere with normal "zlogin" operation.)
    The idea would be to try and use dtrace to attach to some sort of centralized "zlogin construct/object" and then capure ALL zlogin console-output for ALL local zones, with dtrace, and then having that parsed out to log-files for each local zone.
    Might sound a little far-fetched, but until a standard interface for zone-console logging is created, this may be the base we can do?
    If you can think of alternatives, please share them.
    thanks,
    -- MikeE

    For the record: http://blogs.sun.com/roller/page/menno/20050525
    Menno

  • Simple question about systemd console output - can i get a timestamp?

    hello. with the old syslog program, sending the log to a console used to yield essentially the same output as /var/log/everything.log, critically including timestamps before each entry. Now with systemd, enabling console output just gives each entry by itself, so you can't tell if you're looking at 5 seconds worth of activity or 5 days. any way a timestamp can be added here? i'd find that useful on my servers, as I have a screen connected to them but no keyboard.
    thanks

    Console output of what? Please post the exact command you're using and the output.
    # journalctl -b
    -- Logs begin at Sun 2013-08-11 17:23:43 CEST, end at Wed 2013-09-11 05:36:39 CEST. --
    Sep 10 19:11:44 localhost systemd-journal[36]: Runtime journal is using 184.0K (max 49.8M, leaving 74.8M of free 498.4M, current limit 49.8M).
    Sep 10 19:11:44 localhost systemd-journal[36]: Runtime journal is using 188.0K (max 49.8M, leaving 74.8M of free 498.4M, current limit 49.8M).
    Sep 10 19:11:44 localhost kernel: Initializing cgroup subsys cpuset
    Sep 10 19:11:44 localhost kernel: Initializing cgroup subsys cpu
    Sep 10 19:11:44 localhost kernel: Initializing cgroup subsys cpuacct
    Sep 10 19:11:44 localhost kernel: Linux version 3.11.0-1-ARCH (tobias@testing-i686) (gcc version 4.8.1 20130725 (prerelease) (GCC) ) #1 SMP PREEMPT Tue Sep 3 0
    Sep 10 19:11:44 localhost kernel: e820: BIOS-provided physical RAM map:
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x0000000000000000-0x000000000009f7ff] usable
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x00000000000e0000-0x00000000000fffff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x0000000000100000-0x000000003f6effff] usable
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x000000003f6f0000-0x000000003f6fafff] ACPI data
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x000000003f6fb000-0x000000003f6fffff] ACPI NVS
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x000000003f700000-0x000000003f77ffff] usable
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x000000003f780000-0x000000003fffffff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x00000000fec00000-0x00000000fec0ffff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x00000000fee00000-0x00000000fee00fff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x00000000ff800000-0x00000000ffbfffff] reserved
    Sep 10 19:11:44 localhost kernel: BIOS-e820: [mem 0x00000000fffffc00-0x00000000ffffffff] reserved
    <cut>
    Sep 10 19:11:56 black kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
    Sep 10 19:11:56 black systemd-logind[164]: Watching system buttons on /dev/input/event2 (Power Button)
    Sep 10 19:11:56 black systemd-logind[164]: Watching system buttons on /dev/input/event1 (Power Button)
    Sep 10 19:12:00 black login[167]: pam_unix(login:session): session opened for user karol by LOGIN(uid=0)
    Sep 10 19:12:00 black systemd[1]: Starting user-1000.slice.
    Sep 10 19:12:00 black systemd[1]: Created slice user-1000.slice.
    Sep 10 19:12:00 black systemd[1]: Starting User Manager for 1000...
    Sep 10 19:12:00 black systemd-logind[164]: New session 1 of user karol.
    Sep 10 19:12:00 black systemd[1]: Starting Session 1 of user karol.
    Sep 10 19:12:00 black systemd[191]: pam_unix(systemd-shared:session): session opened for user karol by (uid=0)
    Sep 10 19:12:00 black systemd[1]: Started Session 1 of user karol.
    Sep 10 19:12:00 black login[167]: LOGIN ON tty1 BY karol
    Sep 10 19:12:00 black systemd[191]: Failed to open private bus connection: Failed to connect to socket /run/user/1000/dbus/user_bus_socket: No such file or dir
    Sep 10 19:12:00 black systemd[191]: Mounted /sys/kernel/config.
    Sep 10 19:12:01 black systemd[191]: Stopped target Sound Card.
    Sep 10 19:12:01 black systemd[191]: Starting Default.
    Sep 10 19:12:01 black systemd[191]: Reached target Default.
    Sep 10 19:12:01 black systemd[191]: Startup finished in 619ms.
    Sep 10 19:12:01 black systemd[1]: Started User Manager for 1000.
    Sep 10 19:12:00 black dhcpcd[168]: eth0: leased 192.168.1.4 for 259200 seconds
    Sep 10 19:12:00 black dhcpcd[168]: eth0: adding host route to 192.168.1.4 via 127.0.0.1
    Sep 10 19:12:00 black dhcpcd[168]: eth0: adding route to 192.168.1.0/24
    Sep 10 19:12:00 black dhcpcd[168]: eth0: adding default route via 192.168.1.1
    <cut>
    (No idea why there's 'Sep 10 19:12:01' followed by 'Sep 10 19:12:00')

  • Visual Studio 2013 Update 4 - VSTest.console Output SDOUT Messages DURING Test Run, NOT After Test Run Completes

    I am using vstest.console.exe and running a test from our internal CI build system, our internal CI build system requires console standard out to be updated at least every 30 minutes to
    ensure that the process has not hung. 
    I am executing the following command using a customer logger and test settings files:
    vstest.console.exe /testcasefilter:"TestCategory=LongTest" /settings:"C:\testing\CodedUI.testsettings" /logger:TRX /logger:CodedUITestLogger "C:\AppTests\CodedUITest.dll" /InIsolation
    I have copied and modified the following custom logger(see
    here for more info):
    https://github.com/ppiotrowicz/AwesomeLogger
    Such that after the test is executed the pass/fail/success information is printed to the standard out console.
    Tests run: 1, Errors: 0, Failures: 0, Inconclusive: 0, Time: 00:00:87.9331298 minutes
    Not run: 0, Invalid: 0, Ignored: 0, Skipped: 0
    It's important to be clear that the test run takes 90 minutes, it's a long running test.
    Time: 00:00:87.9331298 minutes
    When the test run is executed for 90 minutes I see the following and our CI build system kills the process after 30 minutes of no output, so in the failure log I see:
    vstest.console.exe /testcasefilter:"TestCategory=LongTest" /settings:"C:\testing\CodedUI.testsettings" /logger:TRX /logger:CodedUITestLogger C:\AppTests\CodedUITest.dll
    Microsoft (R) Test Execution Command Line Tool Version 12.0.31101.0
    Copyright (c) Microsoft Corporation. All rights reserved.
    Running tests in C:\testing\bin\debug\TestResults
    Starting test execution, please wait...
    However I have a data-driven codedUI test pulling from a csv data source, that successfully executes, however the test takes 90 minutes to run....which means that for 90 minutes the console output displayed is only:
    Running tests in C:\testing\bin\debug\TestResults
    Starting test execution, please wait...
    How can I have vstest.console output to standard out DURING the test run to the console?
    Is there a way in the .testsettings file to enable more verbose logging
    DURING the test execution?
    In MSTest it was possible to use the parameter (/detail:stdout) which would display info while the test was running.  
    MSTEST /testcontainer:MyDllToTest.dll /testSettings.local.TestSettings /detail:stdout
    Ian Ceicys

    I ended up solving the issue for our internal CI system with the following threaded coded. I don't like that it just prints: CodedUI Test Run in progress. How can I query for a percent complete for test execution status or get a reading on the iteration
    that's running for each row in the csv data source?
    [Test, Category("RunCodedUITest")]
    public void RunVsTestConsole()
    //ARRANGE
    var outputPath = "C:\Tests\bin\debug"
    var codedUIAssembly = Path.Combine(outputPath, "CodedUITest.dll");
    string output;
    string codedUIAssemblyFile = @codedUIAssembly.ToString();
    if (File.Exists(codedUIAssemblyFile))
    //ACT
    CodedUITestRunner codedUiTestRunnerObject = new CodedUITestRunner();
    Thread workerThread = new Thread(codedUiTestRunnerObject.RunTest);
    workerThread.Start();
    while (workerThread.IsAlive)
    TimeSpan oneminute = new TimeSpan(0, 1, 0);
    Console.WriteLine("CodedUI Test Run in progress...");
    Thread.Sleep(oneminute);
    workerThread.Join();
    Console.WriteLine("CodedUI Test Run completed.");
    else
    Console.WriteLine("ERROR: CodedUI Test Assembly file Does NOT exist @ Path : " + codedUIAssemblyFile);
    Assert.IsTrue(File.Exists(codedUIAssemblyFile), "CodedUI Binary DLL exists!" + codedUIAssemblyFile);
    public class CodedUITestRunner
    // This method will be called when the thread is started.
    public void RunTest()
    var outputPath = "C:\Tests\bin\debug"
    var codedUIAssembly = Path.Combine(outputPath, "CodedUITest.dll");
    string output;
    string codedUIAssemblyFile = @codedUIAssembly.ToString();
    output = TestFrameworkHelper.Exec("vstest.console.exe", string.Format("/testcasefilter:\"TestCategory=LongTest\" /settings:\"C:\\tests\\CodedUI.testsettings\" /logger:TRX /logger:CodedUITestLogger {0}",
    codedUIAssembly), WorkingDir: outputPath, RequestEC: false);
    StringAssert.Contains("EXIT CODE: 0", output, "Exit code was not 0.");
    Ian Ceicys

Maybe you are looking for

  • FCP freezes when exporting for iphone

    so i have a widescreen dv project about 2 minutes long and i'm trying to export it to the iphone using the default settings, and when it hits 20%...it totally locks up and won't even force quit. ***?! my whole machine is up to date, but i'm still on

  • META-INF & adf-settings.xml not found ...

    HI All, I am using JDeveloper 11.1.1.4 . I try to register my custom phase listeners to adf-settings.xml file .But it's not available in my View Controller project . Meta-Inf folder & adf-settings.xml file  will create default or not ? ... I read the

  • Advice about buying new Macbook

    Hi all, I'm trying to decide between the Macbook Air and the Macbook Pro with Retina display, and I'd like to see if people have advice about which one would better serve my needs. This is my only computer, and while it needs to be portable, it doesn

  • When I plug in my iPod to sync, my itunes freezes...Help!

    When I plug in my iPod to my Mac, my itunes freezes. Why is this happening? Help please!

  • Can't change file association (Powerpoint 2011 to Powerpoint 2008)

    Hello On my iMac I've recently installed MS Office 2011. The old version of Office 2008 is still installed as well. I've got some problems with the new version of Powerpoint (2011). Therefore I'd like to use the old version of Powerpoint (2008) for a