System.out.println() problem

When I use operator + for concatenate the following Strings
md.getDriverName() + md.getDriverVersion()
as follow in a try block:
try {
con = DriverManager.getConnection(sourceURL,user,pass);
md = con.getMetaData();
System.out.println(md.getDriverName().+md.getDriverVersion());
when I have tried run java -cp postgresql.jar errors message appers :
Exception in thread "main" java.lang.NoClassDefFoundError: while resolving class: conx
at java.lang.VMClassLoader.transformException(java.lang.Class, java.lang.Throwable) (/usr/lib/libgcj.so.6.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
at gnu.java.lang.MainThread.run() (/usr/lib/libgcj.so.6.0.0)
Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:postgresql.jar,file:./], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.6.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String) (/usr/lib/libgcj.so.6.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.6.0.0)
But when I have used netBeans IDE v 4.0 it works fine.
Might somebody help me for solve it.

Caused by: java.lang.ClassNotFoundException: java.lang.StringBuilder not found in
gnu.gcj.runtime.SystemClassLoader{urls=[file:postgresql.jar,file:./],
As I noted in your other post, your computer is configured to use gnu.gcj, not Sun's Java - and it appears that gcj doesn't have the StringBuilder class; it was added to Sun Java in Java 5.

Similar Messages

  • System.out.println and Network Adapter problem

    Hello,
    I am encountering a 2 strange problems. I have 2 oracle application server instances, one dev and one production.
    The first problem is when I type System.out.println in the JSP's i am able to see the output in both \opmn\logs\oc4jinstance. But the System.out.println in the java classes or bean show up only in development logs but not in production box.
    Is there a setting I am missing here?
    The second problem is on our development machine the application works fine, but as soon as we deploy the application on production I encounter:
    could not open new connection: Io exception: The Network Adapter could not establish the connection
    I have a class called DBUtils, which uses a 3rd party library to get connections from the connection pool as below. Using JSP I call the getConnection(). On my dev Oracle Application Server Instance it works fine, but on production I get the error. Can it be there is a setting that I am missing on the production box?
    When I use a JSP and connect to the database without using the DBUtil class. I can connect to the database fine. Also using the DBUtil class with production oracle IP address on the development machine lets me connect with no problem, but production machine does not let me.
    public class DBUtils {
    static ConnectionPoolBean pool;
    static {
    System.out.println("DBUtils() - before connection pool bean");
    pool = new ConnectionPoolBean();
    pool.setDriverClassName("oracle.jdbc.driver.OracleDriver");
    pool.setdbURL("jdbc:oracle:thin:@IPADDRESS:PORT:SID");
    pool.setUser("USERNAME");
    pool.setPassword("PASSWORD");
    pool.setInitialConnections(1);
    pool.setIncrement(1);
    pool.setSoftMaxConnections(40);
    public static Connection getConnection() throws SQLException {
    System.out.println("Getting Oracle Connection");
    return pool.getConnection();
    public static void returnConnection(Connection conn) throws SQLException {
    System.out.println("Returning Connection");
    pool.returnConnection(conn);
    Thanks for your help in advance.

    Hi
    System.out.println is a method of PrintStream in IO which is used to print the output on console in java progs.Here in jsp ,the o/p is printed on server's console window.But out.println is totally different as, out is implicit object derived from JspWriter and is used sly to PrinWriter 's object is used in servlets.It's work is to write upon Browser.
    System.out.println() is normally used in jsp for debugging purposes only.
    Ashish

  • Problems with System.out.println()

    I tried writing a simple 'Hello world'-program:
    public class Test{
         public static void main(String[] args){
              System.out.println("Hello World!");
         }//main()
    }//Test
    But the text wouldn't appear in the DOS-window. The only text that showed up was the standard 'Press any key to close the window'. The program compiled without any problems, but didn't work when I tried to run it.
    Does anyone have any idea what's wrong?

    Are u sure , the main() class part is donecorrectly.
    Becuse program will compile but not run without a
    main() class.what do you mean by main() class???First of all main() is a method, not a class. The main() method the JRE recognizes and runs is the:
    public static void main(String[] params)
    If you don�t have exaclty those modifiers and receive an array of Strings parameter it will send you an runtime exception.
    Your code compiles and runs fine, the problem isn�t really System.out.print() it is something with your configuration.
    I have to rename the class to TestF. Here is the running:
    C:\cJava>javac TestF.java
    C:\cJava>java TestF
    Hello World!

  • Is there a way to make system.out.println() scroll down as it goes?

    I am writing a program where I want to be able to read what's printed out in the console of my IDE through System.out.println() as the program runs/after the program runs. However, right now I run the program, the message prints out, and then when I go to read it the scroll bar is all the way up so I can see only the top of the print-out (the first thing printed out). Is there any way I can get the console to scroll along with the text, kind of like floating boxes you see on various websites for various reasons? In other words, can I get it so that when I look in the console at any given moment of the program running, I am looking at the newest text printed out (the text at the bottom of the "page")? Thank you!

    That would be an IDE problem and not a Java one. You could redirect output into a text file so you can read at your leisure and scroll up and down as much as you like.

  • 32-bit JDK 7 System.out.println not working in IDE

    Hi folks,
    I have a 64-bit Windows 7 OS.
    Due to 3rd party library/jar dependencies, i had to install the 32-bit Java JDK 1.7 and Eclipse IDE.
    I also installed NetBeans.
    So i have a 64-bit OS and am running 32-bit Java JDK/JRE & IDEs.
    The problem I am having is that my program's System.out.println("...") statements are not outputting strings to either IDE debug console.
    Executing the compiled program from a command line/prompt produces the expected string output.
    The basic "Hello, World" program is enough to cause this behaviour to start occurring.
    I have not manually / intentionally changed any IDE-specific Debug Console or Windows environment settings.
    One caveat: This same environment has worked successfully in the past ?! Yes, this is one of those "..it worked last week & yesterday and today it isn't and i swear i didn't do anything..." issue.
    Thoughts ?

    Thanks for the reply.
    The 64-bit versions of Java & Eclipse were installed first.
    When i discovered I had to use the 32-bit versions, i un-installed the 64-bit ones & installed the 32-bits.
    Even after that initial un-install 64-bit/install 32-bit process, it was working.
    I have also been installing the Windows 7 64-bit OS updates when i am informed of them.
    I'm not sure if any of these would affect how the Eclipse / NetBeans IDEs behave.
    Behaviour has been inconsistent.
    Initially it was always working.
    But over the past several days, it has been working less and less.
    I don't have any large data structures.
    This isn't a large complicated program, couple hundred lines, so i highly doubt that i'm doing anything to the resources, but something has changed.
    The main project I am working on takes command line parameters, does some initial processing, produces output using System.out.printlns [SOP] then depending on the parameters, branches into 2 different processing paths, let's call them A & B. Each of these processing paths also use SOPs. When i run the program in the IDE going thru path A, sometimes the initial SOP statements will work and the SOP statements specific to path A will also work. If i immediately change the parameters to go thru path B & re-run it, not even the initial SOP statements before the branching decision work.
    I've tried doing System.flush()s too - no affect.
    I haven't tried the re-direction option to a file option you mentioned yet.
    It always works from a command prompt - that is telling me that the Java SOPs are working properly, correct ?
    Inside an Eclipse or NetBeans IDE, SOP output to the debug console is inconsistent.
    Running from a command prompt, the SOPs always work.
    It'd help to know if this an IDE issue, a Java issue, a Windows 7 issue so i can narrow down where to try and correct the situation.
    I have a Windows XP VM set up, i'll try running the program there and see if there's a difference.
    Thanks for your reply.

  • System.out.println not showing up in the console

    Hi,
    I've some System.out.println statements in a static block in a Stateless
    Session Bean. I could not see these outputs in the Weblogic console. I'm
    using Weblogic 5.1 Any one faced this problem before? any help is
    appreciated.
    Thanks & Regards,
    Nithi.

    Take a look in the weblogic log files they might be redirecting std out.
    "Ryan LeCompte" <[email protected]> wrote:
    >
    Hello Nithi,
    I'm all out of ideas, unfortunately! However, check out the following
    links for
    some possible insight into the problem:
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=60&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3d3df18e%40newsgroups.bea.com&rnum=69
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=70&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3977417b%40newsgroups.bea.com&rnum=71
    http://groups.google.com/groups?q=System.out.println+5.1+WebLogic&start=200&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=3bc20346%241%40newsgroups.bea.com&rnum=209
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply and sorry for the long silence. I was on vocation.
    Thre problem still remains.I'm very sure that the EJB
    is deployed by WebLogic as I'm able to call some methods.
    and I'm also calling EJB methods from Servlet. But my
    System.out.println statments work fine in the Servlet and
    not inside EJB (or anyother classes used by EJB).
    Any one has faced similar problems? BTW am using WebLogic 5.1
    Thanks in advance,
    Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    I find it strange that your System.out.println statements are beingexecuted from
    within your servlets, but not in your stateless session bean. Are
    you
    positive
    that your EJB is being located and deployed by WebLogic? The statementsin
    your
    static { } block should be executed as soon as the WebLogic class
    loader
    finds
    the class and loads it into the JVM. I would suggest examining theconsole
    and
    try to determine if your EJB is in fact being deployed. Are you invokingmethods
    on the EJB inside of your servlets? Are you using any logging frameworkfrom within
    the EJBs which would redirect output to a file?
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi Ryan,
    Thanks for your reply. The setting in the weblogic.properties is
    as
    follows.
    weblogic.system.enableConsole=true
    So, that tells me that I should see all the System.out.printlns right?
    (Pleasecorrect me if I'm wrong). I can see all the System.out.println
    from
    my
    servletand not from the Session Bean (even if the System.out.println
    is
    outside
    static block).
    Please let me know your thoughts.
    Thanks & Regards,
    Nithi.
    "Ryan LeCompte" <[email protected]> wrote in message
    news:[email protected]...
    Hello Nithi,
    Are you sure that you don't have WebLogic configured to redirect
    all
    messages
    to a file instead of the console? Are you able to see yourSystem.out.println
    statements when placed within other methods of your stateless sessionbean? Please
    be a bit more specific.
    Thank you,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Nithi Rajan" <[email protected]> wrote:
    Hi,
    I've some System.out.println statements in a static block in a
    Stateless
    Session Bean. I could not see these outputs in the Weblogic console.
    I'm
    using Weblogic 5.1 Any one faced this problem before? any helpis
    appreciated.
    Thanks & Regards,
    Nithi.

  • System.out.println crashes wireless toolkit

    I'm using system.out.println calls to create debugging commands to test my application. They mostly work but if I try to print out a lot at once the wireless toolkit crashes.
    This is all on my computer, not on any mobile device.
    The error I get is:
    Exception in thread "Child process stdout copier" java.lang.ClassCastException: sun.java2d.NullSurfaceData cannot be cast to sun.java2d.d3d.D3DSurfaceData
         at sun.java2d.d3d.D3DRenderer.copyArea(D3DRenderer.java:55)
         at sun.java2d.d3d.D3DSurfaceData.copyArea(D3DSurfaceData.java:638)
         at sun.java2d.SunGraphics2D.doCopyArea(SunGraphics2D.java:1986)
         at sun.java2d.SunGraphics2D.copyArea(SunGraphics2D.java:1968)
         at javax.swing.BufferStrategyPaintManager.copyArea(BufferStrategyPaintManager.java:315)
         at javax.swing.RepaintManager.copyArea(RepaintManager.java:1228)
         at javax.swing.JViewport.blitDoubleBuffered(JViewport.java:1604)
         at javax.swing.JViewport.windowBlitPaint(JViewport.java:1573)
         at javax.swing.JViewport.setViewPosition(JViewport.java:1118)
         at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.vsbStateChanged(BasicScrollPaneUI.java:1027)
         at javax.swing.plaf.basic.BasicScrollPaneUI$Handler.stateChanged(BasicScrollPaneUI.java:1016)
         at javax.swing.DefaultBoundedRangeModel.fireStateChanged(DefaultBoundedRangeModel.java:348)
         at javax.swing.DefaultBoundedRangeModel.setRangeProperties(DefaultBoundedRangeModel.java:285)
         at javax.swing.DefaultBoundedRangeModel.setValue(DefaultBoundedRangeModel.java:151)
         at javax.swing.JScrollBar.setValue(JScrollBar.java:446)
         at com.sun.kvem.toolbar.MainWindow$ConsoleStream.write(Unknown Source)
         at java.io.PrintStream.write(PrintStream.java:430)
         at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
         at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
         at com.sun.kvem.environment.StreamCopier.run(Unknown Source)
         at java.lang.Thread.run(Thread.java:619)Am I doing something wrong or is this a bug in the toolkit?
    Once I get this exception the whole toolkit becomes unresponsive and I have to close it and re-open.

    mydreamgirl, welcome to the forum. Please don't post in threads that are long dead and don't hijack another poster's thread. When you have a question, start your own topic. Feel free to provide a link to an old post that may be relevant to your problem.
    I'm locking this thread now.
    db

  • System.out.println in SAP J2EE Engine - Config Tool

    Hi everybody.
    I was having problems with viewing my System.out.println sentences in my NetWeaver's J2EE applications.
    It's supposed that I can't see the files because I have to assing a log archive for System.out controller in SAP J2EE Engine - Config Tool.
    The problem is that I can't find the place to modify the property of that controller!
    I've edited the log-configuration.xml file, but when I restart the server to reload the new configuration, the files I've added to this file, disapear.
    Any idea about this???
    Any answer is well accpeted.
    Thanks,
    Alberto.

    Nobody knows something about this System.out problem??
    Thanks!

  • System.out.println in gui--- question

    Hello People.
    First of all, I'm new to the forums, so if it doesn't belong here, plese tell me where to post questions like this.
    The Problem:
    I have a GUI and another class,which contains the Program.
    Here's the code of my class:
    int Battle(String CharName) {
              System.out.println(CharName + " Is fighting agains a monster");
              while (CharHP > 0 && MonsterHP != 0) {
                   MonsterHP = MonsterHP - CharDmg;
                   System.out.println("The monster has " + MonsterHP + "Hitpoints left ");
                   CharHP = CharHP - MonsterDamage;
                   System.out.println(CharName + " has " + CharHP + " Hitpoints left");
              if (MonsterHP == 0) {
                   System.out.println(CharName + "Has lost the fight!");
                   CharEXP = CharEXP + 20;
                   System.out.println("You have gained " + CharEXP + " Exp");
              if (CharHP == 0) {
                   System.out.println("You have lost the fight!");
              return CharHP;
         }So what would be the code to print all the "System.out.println's" here into the gui test area?

    camickr wrote:
    Check out the [Message Console|http://www.camick.com/java/blog.html?name=message-console].
    Just out of curiosity, how do you come up with ideas for all the awesome stuff on your blog?

  • System.out.println ....syntax error?

    Hi,
    I am workin on my first java program here...and althought my classes compile just fine I can't manage to get what I want to appear on the screen on Button action....
    Clicking on cost should trigger the appearance of the total cost...but nothing happens.
    Can you have a look and tell me where I went wrong please?
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class Booking extends Applet implements ItemListener,ActionListener
    String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
    Courses courses_list = new Courses(c);
    Choice ChoiceCourse;
    Choice ChoicePeople;
    Checkbox cb1, cb2, cb3;
    boolean fulltime = false;
    boolean parttime = false;
    boolean concessions = false;
    Button b1;
    int c1;
    int p1;
    int price;
    public void init()
      add(new Label("Courses available for booking : "));
      ChoiceCourse = new Choice();
      add(ChoiceCourse);
    //the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
      int i=0;
      while (i<c.length)
        ChoiceCourse.addItem(courses_list.getTitle(i));
        i++;
      ChoiceCourse.addItemListener(this);
      add(new Label("Number of participants for the course selected : "));
      ChoicePeople = new Choice();
      add(ChoicePeople);
    //the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
      int j=1;
      while (j<11)
        ChoicePeople.addItem(new Integer(j).toString());
        j++;
      ChoicePeople.addItemListener(this);
      cb1 = new Checkbox ("Full-Time");
      add(cb1);
      cb2 = new Checkbox ("Part-Time");
      add (cb2);
      cb3 = new Checkbox ("Concessions");
      add (cb3);
      b1 = new Button ("Cost");
      add (b1);
      b1.addActionListener(this);
      public void itemStateChanged(ItemEvent e)
       if (e.getSource() == ChoiceCourse)
         String c2 = (String) e.getItem();  // When ChoiceCourse is modified
         if (c2 == "French Language")
           int c1 = 0;
         if (c2 == "Painting")
           int c1 = 1;
         else
           int c1 = 2;
       if (e.getSource() == ChoicePeople)
         String p2 = (String) e.getItem();  // When ChoicePeople is modified
         int p1=Integer.parseInt(p2);       // converts the String into an integer
      public void actionPerformed(ActionEvent e)
        if ( e.getActionCommand() == "Cost" )
          fulltime = cb1.getState();
          parttime = cb2.getState();
          concessions = cb3.getState();
          if (fulltime == true)
            int price = 1;
          if (parttime == true)
            int price = 2;
          else
            int price = 3;
          int mode =  Integer.parseInt(c[c1][price]);  
          System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
    }

    Thanks for the guidance and the explanations. I've improved my code according to your recommendations (1, 2 &3) and it compiles just fine.
    However, the println still doesn't work...but there is improvement:
    When I run my applet using the AppletViewer at the very end I get a log of what happened...and it's now showing:
    "D:\JBuilder8\jdk1.4\bin\appletviewer.exe Booking.html
    total cost of your selection is: �0"
    Which means that the println is being called but is not printing where it should be (on my screen)....the other problem is that it is obviously not properly calculating the total cost since it shouldn't be �0.
    Here is my new (improved) code, and below is the code for the Courses class (which does some of the calculation):
    import java.awt.*;
    import java.awt.event.*;
    import java.applet.*;
    import java.util.*;
    public class Booking extends Applet implements ItemListener,ActionListener
    String[][] c = { {"French Language","250","130","70"}, {"Painting","270","140","70"}, {"Yoga","250","130","70"} };
    Courses courses_list = new Courses(c);
    Choice ChoiceCourse;
    Choice ChoicePeople;
    Checkbox cb1, cb2, cb3;
    boolean fulltime = false;
    boolean parttime = false;
    boolean concessions = false;
    Button b1;
    int c1;
    int p1;
    int price;
    public void init()
      add(new Label("Courses available for booking : "));
      ChoiceCourse = new Choice();
      add(ChoiceCourse);
    //the following populates the ChoiceCourse dropDown Menu with the Courses'Titles
      int i=0;
      while (i<c.length)
        ChoiceCourse.addItem(courses_list.getTitle(i));
        i++;
      ChoiceCourse.addItemListener(this);
      add(new Label("Number of participants for the course selected : "));
      ChoicePeople = new Choice();
      add(ChoicePeople);
    //the following populates the ChoicePeople dropDown Menu with "numbers" from 1 to 10
      int j=1;
      while (j<11)
        ChoicePeople.addItem(new Integer(j).toString());
        j++;
      ChoicePeople.addItemListener(this);
      cb1 = new Checkbox ("Full-Time");
      add(cb1);
      cb2 = new Checkbox ("Part-Time");
      add (cb2);
      cb3 = new Checkbox ("Concessions");
      add (cb3);
      b1 = new Button ("Cost");
      add (b1);
      b1.addActionListener(this);
      public void itemStateChanged(ItemEvent e)
       if (e.getSource().equals (ChoiceCourse)) //should this be == or .equals? it doesn't work either way but compiles
         String c2 = (String) e.getItem();  // When ChoiceCourse is modified
         if (c2.equals ("French Language"))
           c1 = 0;
         if (c2.equals ("Painting"))
           c1 = 1;
         else
           c1 = 2;
       if (e.getSource().equals (ChoicePeople)) //should this be == or .equals?it doesn't work either way but compiles
         String p2 = (String) e.getItem();  // When ChoicePeople is modified
         p1=Integer.parseInt(p2);       // converts the String into an integer
      public void actionPerformed(ActionEvent e)
        if ( e.getActionCommand().equals ("Cost") )
          fulltime = cb1.getState();
          parttime = cb2.getState();
          concessions = cb3.getState();
          if (fulltime)
            price = 1;
          if (parttime)
            price = 2;
          else
            price = 3;
          int mode =  Integer.parseInt(c[c1][price]);  
          System.out.println("total cost of your selection is: �" + courses_list.getCost(p1,mode));
    class Courses
    import java.util.*;
    public class Courses
    private String[][] Listing = new String[3][4]; //create array 3 rows * 4 columns
    Courses(String[][] c)
       this.Listing=c;
    int i;
    int j;
    int p;
    int price;
    int people;
    int cost;
    String t;
    String p1;
    String getTitle(int i)  //return Course Title
       t=Listing[0];
    return t;
    int getPrice(int i, int j) //return Price (Full-Time, Part-Time, Concessions)
    p1=Listing[i][j];
    p=Integer.parseInt(p1);
    return p;
    int getCost(int pe, int pp)
    pe=price;
    pp=people;
    cost=pe*pp;
    return cost;

  • How can I show a System.out.println(""); into a JSP?

    Is a simple doubt that would help me a lot to reach other thing that I wished reach with a JSP.
    Thank you!!!

    Hi!!!
    Thank you to answer me......my question�is because�my problem is a little more complicated��let me tell you�.
    My problem is that I wish to do some queries to a table of a Municipalities DB, I have read about that....and according with the exemples....my JSP...should be running and executing very well....but I haven�t had success with that...:(
    My JSP file is:
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    catch (Exception e) {
    e.printStackTrace();
    Statement stmt = conn.createStatement();
    stmt.execute("select * from cat_municipio");
    ResultSet rs = stmt.getResultSet();
    while (rs.next()) {
    System.out.println(rs.getInt("cve_municipio") + " - " + rs.getInt("cve_sepomex") + " - " + rs.getString("desc_municipio"));
    stmt.close();
    conn.close();
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>
    My result obtained is the following:
    Municipalities List
    Please call Mary with any updates ASAP!
    Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    I don�t obtain nothing.....is like DB table were without information......but in reality the DB table has information.....and I can obtain it with the following JSP:
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    // Fetch all records from the database in a TableDataSet
    DataSet dSet = new TableDataSet(conn, "cat_municipio").fetchRecords();
    TableElement tE = new TableElement(dSet);
    tE.setBorder(1);
    out.print(tE);
    } catch (SQLException sqle) {
    out.print("Sorry, the database is not available.");
    out.print("Exception: " + sqle);
    } catch (Exception e) {
    out.print("Exception occured: " + e);
    } finally {
    if(conn != null)
    try {
    conn.close();
    } catch(SQLException sqle) {}
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>
    and with this JSP I obtain all the following information:
    Municipalities List
    CVE_MUNICIPIO CVE_SEPOMEX DESC_MUNICIPIO
    1 1 ACAJETE
    2 2 ACATENO
    3 3 ACATLAN
    4 4 ACATZINGO
    5 5 ACTEOPAN
    Now...I need that the first JSP work very well, because...with that way...I can do queries and obtain the needed results for showing them in the Browser......
    So, I already find out�.that�any string that I send to the browser with System.out.println(); isn�t showed�.so it is the reason of my question�..how I can see my results of a query using a loop (like a for, while) resolving it....I think my problem would be resolved.
    So...I hope you understand me, and you could help me please...thanks.....
    Mary
    P.D. I also attempted with the following JSP...but the result is the same....I don�t obtain none result...
    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <!-- Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.-->
    <head>
    <title>Query of Municipalities</title>
    </head>
    <body bgcolor=#FFFFFF>
    <font face="Helvetica">
    <h1>
    <font color=#DB1260>
    Municipalities List
    </font>
    </h1>
    <%@ page import="
    weblogic.db.jdbc.*,
    weblogic.html.*,
    java.sql.*
    " %>
    <p>
    <%
    Connection conn = null;
    try {
    Class.forName("weblogic.jdbc.pool.Driver").newInstance();
    conn = DriverManager.getConnection("jdbc:weblogic:pool:DESAPool");
    catch (Exception e) {
    e.printStackTrace();
    Statement stmt = conn.createStatement();
    ResultSet rs = stmt.executeQuery("select CVE_MUNICIPIO, CVE_SEPOMEX, DESC_MUNICIPIO from cat_municipio");
    while (rs.next()) {
    System.out.println(rs.getInt(1) + " - " + rs.getInt(2) + " - " + rs.getString(3));
    rs.close();
    stmt.close();
    conn.close();
    %>
    <p>Please call Mary with any updates ASAP!
    <p>
    <font size=-1>Copyright (c) 1999-2000 by BEA Systems, Inc. All Rights Reserved.
    </font>
    </font>
    </body>
    </html>

  • Synchronized use of System.out.println()

    So I am again at the point of part of my program running ahead of itself out of the call stack and ruining the sequence or order of printing.
    I read that System.out.println() is synchronized so how may it be used to wait() until notified to continue and not ruin the output?

    jverd wrote:
    Always Learning wrote:
    YES SIR EJP! SIR! I thank you for the assistance because using only System.out and synchronizing worked beautifully.You said you're not using multiple threads. If this is true, then there's no reason to synchronize anything. The output will appear on System.out in exactly the order you send it there.
    Nos if only I could figure out dependencies to make it work with out and err.You have to stop and think about it for a minute. You know that when you call println() on either one of those two streams, the output may be buffered an not necessarily go immediately to the console. From that you can reason that if you call out.println() first, and then err.println(), that you could end up with err's buffer getting flushed first, and the output appearing on the console in a different order than that in which your code executed the calls.
    You are of course not surprised by this, given that you know that out and err are completely independent and just happen to end up at the same destination in this particular case.
    So, as a first guess, you might reasonably think that, since buffering is obviously the culprit here, calling flush() on each stream after each print() or println() call should eliminate the problem. In a multithreaded environment, this wouldn't be sufficient, of course, but it's a logical approach to try here.
    Another tidbit to make note of is that the System class has setOut() and setErr() calls. Since you're looking at out and err in the same console, you presumably don't care about the distinction between them (which makes me wonder why you're using them both in the first place, instead of just using one). If you're just going to mush them together into the same console anyway, then you can use setOut() or setErr() to make them the same stream, and things will be ordered as you expect.Very interesting Jverd and I think there may yet be life in what I would like to do. I did not know or was not immediately aware of these things. I will give it a try.
    To answer your question, I am using them both because, like logging, they are distinct in the Eclipse console (black for out and red for err). With your patch I just tried that distinction has faded but the output is sequenced the same so I do appreciate you noting this. Learn something new in Java each time I am doing a project. I considered using logging and putting errors in a window but I am not sure if I should do that; just not enough experience with it.
    Edited by: Always Learning on Oct 23, 2011 9:28 AM

  • Is it possible to overide System.out.println()....

    Hi all,
    I have a program which uses System.out.println() a lot. As the whole program needed to be in GUI form, I have to abbandon the console window and print all my outputs to a special text pane which I have already created and tested.
    My problem is, is there a way for me to keep my System.out.println() statements as they are and print the outputs to my text pane instead of printing it to the console?
    Can I use some kind of overriding of System.out.println()? If so can anybody tell me how to do it?
    Thank you all in advance

    Hi again guys,
    I managed to get the system.out working. Thanks again. But I was trying to do the same to system.in using a class that inherits from InputStream and failed, can you help me out again pliz.
    following is a simplified version of the code. problem I have is that the input I get on readButton click(see the code) is always -1. The code doesn't wait for user input . How can I correct this. please help Thanx
    public class Main() implements ActionListener
        JTextPane textPane;
        JButton readButton;
        public Main()
                this.initGUI();
                Console myConsole = new Console(this.textPane);
                System.setIn(new myInputStream(myConsole));
        private void initGUI()
               this.textPane = new JTextPane();
               this.readButton = new readButton();
               this.readButton.AddActionListener(this);
                //code to create the GUI and show the textPane
               //follows
         public void ActionPerformed(ActionEvent e)
                 try
                             int keyCode = System.in.read();
                     }Catch(Exception e)
                 System.out.println("Pressed Key Code is " + keyCode);          
         public static void main(String[] args)
                   new Main();
    public class Console extends KeyListener
         JTextPane textPane;
         int pressedKey = -1;
         public console(JTextPane textPane)
                 this.textPane = textPane;
                 this.textPane.addKeyListener(this);
        public void keypressed(KeyEvent e)
                this.pressedKey = e.getKeyCode();
       public int read()
               return this.pressedKey;
    public class myInputStream extends InputStream
                Console console;
                public myInputStream(Console console)
                       this.console = console;
                public int read()
                       return this.console.read();
    }

  • System.out.println stalls my jdev

    Hello
    Is there a bug database with regards to JDeveloper 3.0?? My JDev seems to stall when I attempt to type out a "System.out.println(..)" statement. Has anyone encountered something similar?? WinNt4.0 workstation (sp5)
    Tia,
    -Robert-

    Same problem, NT 4.0. Often it stalls just when you type the open parenthesis prior to the string. My guess is it has something to do with the popup choices menu for that method. I don't know how to fix it but I'm using a clunky work-around by copying and pasting something like:
    System.out.println("");
    which includes the quotes inside the parentheses. That seems to keep the popup from trying to show up.

  • Can't run java apps with System.out.println on any builder.

    Hello,
    I'm currently using Vista RC2, which is the immediate problem.
    Classes with System.out.println won't launch the console window. As I'm a student and practicing on these steps, I do have quite a problem on my hands. I click on run, build succesfull, nothing happens.
    I have tried Netbeans and Jcreator, and gave up on trying different builds, as I reckon I'll have to find some other way to counter this; any way to get println messages working in vista?

    It is run as a desktop app, and other runs with commands such as JOptionPane do function, only the println windows don't appear at all. So I think JRE is installed and working.
    I did notice there was one command for input where I'd be able to enter it at the bottom of Netbeans.
    Like just now I clicked build and run for the following code
    import java.util.*;
    public class FirstProgram
        public static void main(String[] args)
            System.out.println("Hello out there.");
            System.out.println("I will add two numbers for you.");
            System.out.println("Enter two whole numbers on a line:");
            int n1, n2;
            Scanner keyboard = new Scanner(System.in);
            n1=keyboard.nextInt();
            n2=keyboard.nextInt();
            System.out.println("The sum of those two numbers is");
            System.out.println(n1+n2)
    }Resulting in a brief flash of "input" in the output window (which is below the coding window) and it dissapears. But this also occurs when I don't include system scanner code.
    Using commands in cmd
    java -jar "C:\Users\Alegis\Netb\MyApp\dist\MyApp.jar"
    Does not yield desired results either. Nothing happens.

Maybe you are looking for

  • Need to run the package

    Hi friends, i need to run a package which will send a mail as soon after it runned. I have a package. But i need to run that package for each and every 10 min in a day. For that how i can create a job to execute that package. As a result of the job f

  • Trackpad button not working on 2.53GHz MBP 13in...

    Hi Guys, The trackpad button has just stopped working. It still clicks but nothing happens. Furthermore whilst using 'Tap to click' works I cannot drag anything to the trash or move anything at all unless I plug in a USB mouse. The only thing I've do

  • Title text disappearing between sessions

    One of the genuinely annoying, and potentially job-threatening, bugs in FCP X is this: When working on a project with title text (lower thirds, text on screen, title slides, end credits, etc) the customized text will often just clear out between FCP

  • External Monitor bug

    Hi, i am working on a Macbook Pro Retina and a Fujitsu Siemens external 21,5" Monitor, when i take a window from my Macbook Monitor to the external, it look like this: can somebody tell me how to fix this bug? its not appearing very often, but someti

  • Reporting que

    Hi In my current system , source system didnot maintained Regions (South,north,east, west) they maintianed only the states. My reporting requirement is to develop the report for region...means region wise sales across country.. making changes for reg