Output to the console

Hi,
How can we output easily a message to the console when running a function?

You will also have to do a
set serveroutput on;
on the console to get the messages.
Rajat,
OTN Team @IDC

Similar Messages

  • My first PKGBUILD - stock ticker style output on the console

    I created my first PKGBUILD of a simple program I wrote called "ticker" which just converts input text to scrolling stock ticker style output on the console.
    The PKGBUILD and a screenshot are at http://www.fial.com/~scott/ticker 
    I'd like to submit it to the AUR, but I'd really appreciate any comments/advice first.
    Scott
    Last edited by scottfial (2010-07-04 00:38:38)

    Writing what it's about in your post (title) would help building interest, I suppose.

  • Can you change the color of the output in the console?

    When you run your program using NetBeans the color of the output in the console window is black. Is there any way to change the color of the output to say blue?

    Hi AJL,
    There is no way to color rows of the table control in a SUDialog. You could consider using the ActiveX container control and using the Microsoft ActiveX table control, which might have that functionality. Note though, that then you need to either ensure that control is always on all your client machines or make provisions for it to be installed/registered.
    Brad Turpin
    DIAdem Product Support Engineer
    National Instruments

  • Capturing all the text that I output to the console

    HOw do I capture all the text I output to the console to a file. I know how to open filebuffers and all that, well I don't really know, but I have some sample code that I can follow. I am just wondering if I am suppose to just open the file buffer, then run my normal application with all the system.out.println() statements and then have that fed to a file? Right now I am using a lot of println() statements to debug, and I would like to be able to push it into a file so I can look at it later, without having that console line limitation.
    My guess is to just open up a filestream and have it open and then run my normal code and then close the filestream at the end. Can somebody let me know if that is good enough...
    let say I have a static method hat outputs a bunch of text, can I do this
    filestream open
    static method run
    filestream close
    and that's it.

    I could see why you'd want to automatically
    route output to a file, that normally would
    go to the console. There might be use for
    capturing output lines.
    If the question is to avoid having to specify
    the output on the command line, then what
    one can do is to create a ".bat" file.
    Ex.
    kstring.bat
    ======================================
    @java kstring > kstring.out
    Now in executing, you'd just ==> kstring
    Which will execute the kstring.bat,
    and since "> kstring.out " is inside
    the "bat", your output goes to the
    kstring.out, instead of the console.
    This would be another way, saves all the
    redirection in Java code. Just use the
    DOS command inside a xxx.bat file.
    Just my opinion, may not work in your
    circumstance.
    -- gte99te

  • Directing std output to the console window

    I am trying to direct the standard output from a separately executed console program to the console window belonging to the running application. How can I do this?
    For example, in the following code, if I execute the simple Windows 'dir' command using .exec, how can I make the output go to the application's console instead of going to a separate window?
    import java.io.*;
    class dir
      public static void main(String[] args)
        try
          Process runprogram = Runtime.getRuntime().exec("cmd.exe /C start dir");             
        catch(IOException e){}
    }

    First I will post the mandatory link for everybody who asks about Runtime.exec():
    http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html
    Read that and notice the bit about getting data from the process's output stream. You can copy that data to the console.

  • How to get the select * from emp table output on the console  using java

    public class software {
          * @param args
         static final String JDBC_DRIVER = "oracle.jdbc.driver.OracleDriver";
         static final String DATABASE_URL = "jdbc:oracle:abc";
         private static Connection connection;
         private static Statement statement;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
         try {
              System.out.println("-------THIS IS THE Class.forNameJDBC_DRIVER");
                   Class.forName(JDBC_DRIVER);
                   System.out.println("THIS IS THE Class.forNameJDBC_DRIVER");
                   connection = DriverManager.getConnection(DATABASE_URL, "abc",
                   "abc");
                   System.out.println("THIS IS THE connection abc ,abc");
                   statement = connection.createStatement();
                   //Query to find the values in the EMP table.
                   ResultSet resultSet = statement.executeQuery("SELECT * from EMP");
                   if(resultSet.next()){
                   System.out.println("THESE ARE THE VALUES IN EMP TABLE:"+resultSet);  /// How can i get all the values record wise on the  console ??????
                   resultSet.close();
         catch (ClassNotFoundException classNotFound) {
                   System.out.println("Driver not Found"+classNotFound.getMessage());
              } catch (SQLException sqlException) {
                   System.out.println("SQL Exception - bad sql");
                   System.out.println(sqlException.getMessage());
    }

    1sai
    Please assign the dukes here and in your previous threads.
    See [http://wikis.sun.com/display/SunForums/Duke+Stars+Program+-+How+it+Works]
    You are currently the all time career leader in un-awarded dukes, with including this thread 75 unawarded dukes for questions you marked as answered.
    It's even worse when you look and see that you have awarded many dukes as well. So you do know how to do it. You're just too lazy and rude to be bothered.
    Don't be a lazy wank.

  • Problem outputting to the screen using  FileDescriptor.out

    I have the following program that reads prime numbers from a binary file. The issue is that the numbers are not printing to the screen using
    FormatWriter out = new FormatWriter(
           new BufferedWriter(
           new FileWriter(FileDescriptor.out)));The numbers are being read from the file as if I unblock the line
    // System.out.println(primes[j]); the numbers are printed to the screen.
    I have pasted the code below and the code that creates the prime numbers file.
    Thanks for any help.
    package readprimes;
    import java.io.*;
    public class ReadPrimes {
       public static void main(String[] args) {
           File myPrimes;
           DataInputStream primesIn;
            try{
                String directory = "C:/JunkData";
                String fileName = "Prime.bin";
                myPrimes = new File(directory, fileName);
                 primesIn = new DataInputStream(new FileInputStream(myPrimes));
            catch(FileNotFoundException e){
                return;
            catch(IOException e){
                return;
        FormatWriter out = new FormatWriter(
           new BufferedWriter(
           new FileWriter(FileDescriptor.out)));
            long[] primes = new long[6];
            boolean EOF = false;
            while(!EOF){
                int index = 0;
                try{
                    for(index = 0; index < primes.length; index++)
                        primes[index] = primesIn.readLong();
                       catch(IOException e){
                return;
    //             catch(EOFException e){
    //                 EOF =  true;
                for(int j = 0;j < index; j++){
             //       System.out.println(primes[j]);
                    out.print(primes[j]);
                    out.println();
    out.close();
    package readprimes;
    import java.io.PrintWriter;
    import java.io.*;
    public class FormatWriter extends PrintWriter{
        private int width = 10;
        public FormatWriter(Writer output){
            super(output);
        public FormatWriter(Writer output, int width){
            super(output);
            this.width = width;
        public FormatWriter(Writer output, boolean autoflush){
            super(output, autoflush);
            public FormatWriter(Writer output, boolean autoflush, int width){
            super(output, autoflush);
            this.width = width;
    Class that creates the prime number file
    package bufferedoutput;
    import java.io.*;
    public class TryPrimesOutput {
       public static void main(String[] args) {
           long[] primes = new long[200];
           primes[0] = 2;
           primes[1] = 3;
           int count = 2;
           long number = 5;
           outer:
           for(; count < primes.length; number +=2L)
               long limit = (long)Math.ceil(Math.sqrt((double)number));
               for(int i = 1; i <count && primes<= limit; i++)
    if(number%primes[i]==0)
    continue outer;
    primes[count++] = number;
    try
    String dirName = "c:\\JunkData";
    String fileName = "Prime.bin";
    File myPrimeDir = new File(dirName);
    if(!myPrimeDir.exists())
    myPrimeDir.mkdir();
    else
    if(!myPrimeDir.isDirectory())
    System.err.println();
    return;
    File primesFile = new File(myPrimeDir, fileName);
    primesFile.createNewFile();
    DataOutputStream primesStream = new DataOutputStream(
    new BufferedOutputStream(
    new FileOutputStream(primesFile)));
    for(int i = 0; i <primes.length;i++)
    primesStream.writeLong(primes[i]);
    primesStream.close();
    catch(IOException e){
    System.out.println("IOExcetoptj");

    Indeed. It isn't obvious to me what the result of new FileWriter(FileDescriptor.out) would result in, but your test appears to show that it doesn't result in something which can be used to output to the console.

  • How to view output on the server?

    When I run WLS locally inside JDeveloper, I can see the output in the console when I have System.out.println() in my web application code.
    After I deploy it to the server, where do I go to see the same output?
    I'm using WLS 10.3.2

    If you still don't see the System.out.printlns in the logs folder look in this file. When you start the weblogic server usually you use like in windows startWeblogic.cmd. So look in that console and it should have the output. Same thing on Linux also, see the shell wiindow where you started weblogic and there you will see the output.
    Usually the bestpractice in linux is to use nohup command to start weblogic and redirect the output to any file. In this way, you can close that shell and still the weblogic will be running and all outputs will be in this log file. You can write a simple file like admin_start.sh with below lines and use this to start weblogic like ./admin_start.sh
    DOMAIN_HOME="/yourFullPath/Oracle/Middleware115/user_projects/domains/yourDomain1"
    LOG_FILE="/yourFullPath/Oracle/Middleware115/user_projects/domains/yourDomain1/logs/admin.log" (The file name can be anything)
    nohup ${DOMAIN_HOME}/bin/startWebLogic.sh > ${LOG_FILE} &
    Thanks
    Ravi Jegga

  • How to use logger to send any output instead of the console?

    How to use logger to send any output instead of the console?

    How to use logger to send any output instead of the
    console?There are three commonly used logger inferfaces, the log4j, the java.util.loging and the Commons logging (which works with either.)
    You create a logger object, generally one for each class. Normally a private static variable points to it and it has a name equal to the FQN of the class.
    e.g.
    package org.widget;
    public class MyClass {
      private static   Logger log = Logger.getLogger("org.widget.MyClass");That's the java.uitil.Logger formula.
    Then there are method on the logger to call for various kinds of output. There' are different logging levels, priorities like SEVERE or DEBUG. When running the logs are configured to ignore messages of less than a set priority.
    You can also pass an Exception or Error to the logger which will log the stack trace.

  • Calculate the size(in bytes) that will be displayed to the console by command Write-Output

    Is there some way to check the size(in bytes) of the output that will be displayed to the console using Write-Output command. I want the console to display only the first 1024 bytes of the objects output.

    Hi Sachin,
    in that case let me add an example on how to read content from a file that may be or may not be a text file:
    $string = [System.Text.Encoding]::UTF8.GetString([System.IO.File]::ReadAllBytes("D:\example.txt"))
    Theoretically, the "Get-Content" cmdlet ought to do the same, however I have occasionally experienced different results.
    You can choose to not convert it to string and just print the bytes too (or choose another encoding of your preference). Remember, a single letter usually uses 2 bytes, thus reading the first 1024 bytes from a file you converted to text would mean printing
    the first 512 letters.
    Cheers,
    Fred
    There's no place like 127.0.0.1

  • WHere Do I view the console Output for SAPJ2EE Server

    In which file do  i see the  console logs for SAP j2EE 6.4
    for eg in my servlet i write System.out.println("ABCD");
    where do  i see this output.

    Hi Nilesh,
    have a look at this thread:
    Regards André

  • How to see console outputs at the Netweaver Developr Studio

    Hello,
    I am using the Netweaver Developr Studio
    Let's say my program is having this line: System.out.println("Hello");
    Is there any way to see this output at the Developr Studio console?

    Hi Roy,
    since your WebDynPro application runs on the server & not within local JVM, you can only see this on the machine which crashes when you try to execute
    System.out.println(".");
    System.exit(0);
    . would be then seen on the host which crashed, under
    /sap/usr/cluster/server/managers/console_logs/
    hope this helps (:,
    ds
    ps. tail is a really cool unix tool (tail -f <logFile>.log for follow) to make such contemplation even better

  • How can i output information at the same location of the console?

    I want to print some messages at the same line(location) of the console
    how can i do that?
    thank a lot!

    If I understand correctly, it is console specific with cursor controls that your console understands.

  • Error message by periodic weekly: No output from the 1 file processed

    Hi there,
    since four weeks, I got a problem with the maintenance script periodic weekly. Up to December 22nd, the script did, what it should do: rebuilding the database of locate and whatis, rotating log-files. Since one week later, I got the error message: No output from the 1 file processed.
    Normally, I use Anacron to do the job. When I noticed the problem, I tried to start the script with Tinker Tool System getting the same result. Another try using the Terminal (sudo periodic weekly) also failed. The commands locate and whatis are working, locate.updatedb and makewhatis also. I'm running 10.4.8; in the past, I did not have such problems. Anyone with an idea or solution?
    Thanks
    Klaus
    MacBook Pro   Mac OS X (10.4.8)  

    Hi Gary,
    here is the output you were asking for:
    Last login: Thu Jan 25 20:03:55 on console
    Welcome to Darwin!
    DeepThought:~ dirk$ sudo /private/etc/periodic/weekly/500.weekly; echo $?
    Password:
    Sorry, try again.
    Password:
    Rebuilding locate database:
    Rebuilding whatis database:
    find: /usr/local/man: No such file or directory
    makewhatis: /usr/share/man/man1/fetchmailconf.1.gz: No such file or directory
    Rotating log files: ftp.log lpr.log mail.log netinfo.log ipfw.log ppp.log secure.log
    access_log error_log
    Running weekly.local:
    Rotating psync log files:/etc/weekly.local: line 17: syntax error near unexpected token `)'
    /etc/weekly.local: line 17: `if [ -f /var/run/syslog.pid ]; then kill -HUP 0 80 79 81 0cat /var/run/syslog.pid | head -1); fi'
    2
    DeepThought:~ dirk$ ls -loe /private/etc/periodic/weekly/500.weekly
    -r-xr-xr-x 1 root wheel - 2532 Jan 13 2006 /private/etc/periodic/weekly/500.weekly
    DeepThought:~ dirk$
    It seems, Rogers idea, PsynX respectively the deficient uninstalling by me is responsible for my problems, is correct. Should I remove the whole file weekly.local or should I only remove the content? I prefer removing the whole file, because it was created while installing PsyncX. The date of creation is the same as the date of installing the app (December 25).
    Klaus
    By the way: it seems to me, the solution of my problem is in sight. So I want to thank you all for the amazing aid I got from you!

  • Help using right-click to display text in the console/call a pop-up menu

    Hi folks,
    I hope someone can help me with this problem because, to be honest, I cannot see where I'm going wrong!
    Basically, I'm trying to create a routine to display a bit of text in the console (and, if I can get this to work, call a pop-up menu) if a user clicks on an image panel (which I've already created and works fine). My code for this is as follows:
    // --- Rest of program here
    this.addMouseListener(new MouseAdapter()
    public void mouseClicked(MouseEvent e)
    // This bit works fine
    if (e.getClickCount()>=2)
    // Display a dialog box if the user double clicks on the panel
    else if (e.isPopupTrigger())
    System.out.println("Right mouse button clicked")
    // Rest of program in hereThe problem is that, despite my best efforts, "Right mouse button clicked" does not display in the console if the right mouse button is clicked, and I cannot figure out why. I can, however, get it to work PARTIALLY if I use e.isControlDown(), but this only works (I guess) if the user is working on a Mac but isn't using an external mouse. Not ideal.
    I'm developing on a Mac (10.4.8) using Eclipse (rather than a PC), but this surely cannot be the problem?

    Do you start this application in a console window?
    If yes then isPopupTrigger() is never true - presumably mouseClicked gets called.
    If no then please note that java does not 'pop' a console window when System.out is called. System.out represents an existing output connection. If you want to pop some sort of console then you need to add code to do that.

Maybe you are looking for

  • Variant description in ME6G

    Dear all, There is one requirement for ME6G - Vendor evaluation in background When we select the variant when we define background job in ME6G in the "STEP", only the variant name is appearing. The requirement is when we press F4 for selection of the

  • Available for verizon or others?

    will the iphone ever be available for verizon or different companies?

  • BPM Smart Playlist Rules not Syncing

    I noticed the following behavior. I created 3 smart playlists, all 3 containing many rules including some to match specific BPM (Beats Per Minute) rules. Only the Smart Playlist names appear on my iPhone 5s, none of the 3 lists is populated. However,

  • Question about ACL permissions

    I have a situation and i wounder how to set up the permissions to make it work. I have a folder (the share point) with ~200 subfolders,(called -1000,-2000, -3000, etc etc) In these folders there are tons of pictures. I want a group(picturesRW) to be

  • 5800 Vanishing Gallery.... Help plse

    Hi All, Can anyone help, I was blutoothed some pictures & music from my wifes fone, which i saved onto my memory card but since then I cant acces my photos/videos in the gallery. I try to open the folder to view them & it just dissapears & takes me b