Help me to run JDBC program

hi friends, my problem is i am unable to run JDBC prg.
i set classpath of classes12.zip, still my problem is unsolved.......
how i have to set classpath

BaluSC i will retify my mistake
could u plz guide meGo read the following link.... (and that is a link in the above response.)
http://www.catb.org/~esr/faqs/smart-questions.html

Similar Messages

  • How to run Struts program with the help of tomcat

    Hello Everybody
    This is Adesh.I am a newcomer of java and facing a problem with struts, so if any one know how to set the path of struts and how to run struts program, so plz inform me.
    THX in Advance.............................................

    struts-config.xml
    <struts-config>
    <action-mappings>
         <action path  = "/welcome"
                    type  = "Welcome"
                    scope="session">
                <forward name="success" path=".welcome"/>
                <forward name="failure" path=".base.error"/>
         </action>
    </action-mappings>
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
            <set-property property="definitions-debug" value="1"/>
            <set-property property="definitions-parser-details" value="0"/>
            <set-property property="definitions-parser-validate" value="true"/>
        </plug-in>
    </struts-config>tiles-defs.xml
    <tiles-definitions>
         <definition name = ".base" path = "/include/template.jsp">
              <put name = "title" value = "${title}"/>
              <put name = "header" value = "/include/top.jsp"/>
              <put name = "body" value = "${body}"/>
              <put name = "footer" value = "/include/footer.jsp"/>
         </definition>
    </tiles-definitions>web.xml
    <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
    <init-param>
                <param-name>definitions-config</param-name>
                <param-value>/WEB-INF/tiles-defs.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet>
            <servlet-name>init</servlet-name>
            <servlet-class>Init</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
      <jsp-config>
        <taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/wall.tld</taglib-uri>
            <taglib-location>/WEB-INF/wall.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/c.tld</taglib-uri>
            <taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fn.tld</taglib-uri>
            <taglib-location>/WEB-INF/fn.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fmt.tld</taglib-uri>
            <taglib-location>/WEB-INF/fmt.tld</taglib-location>
        </taglib>
    </jsp-config>
        <resource-ref>
            <description>DB Connection</description>
            <res-ref-name>jdbc/SQLServerDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    </web-app>This should help....

  • What is wrong with my tiny jdbc program? Help!!!

    Hi,
    Would anyone diagnose the problem of my simple jdbc program?
    The situation is :
    a) local machine oracle thin driver connection; "lsnrctl" is running.
    b) I can query the statement "select id from gameUser" from SQLPLUS logged in as "scott", with desirable result.
    c) There are two code lines commented out in the code, if I uncomment them and instead comment out their counterparts and run the program, the "rset" would contain the result I want. But if I run the program unchanged, the output is only "hi".
    d) If I change the query statement to a wrong column name or a wrong table name, there would be a sql exception. So I surmise that the connection with the database is successful. But how come there is no query result???
    The follow is my coding.
    import java.sql.*;
    class dbAccess {
    public static void main (String args []) throws SQLException
    DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
    try{
    Connection conn = DriverManager.getConnection
    ("jdbc:oracle:thin:orcl", "scott", "tiger");
    // ("jdbc:oracle:thin:orcl", "system", "manager");
    Statement stmt = conn.createStatement();
    ResultSet rset = stmt.executeQuery("select ID from scott.gameUser");
    // ResultSet rset = stmt.executeQuery("select BANNER from SYS.V_$VERSION");
    while (rset.next())
    System.out.println (rset.getString(1)); stmt.close();
    System.out.println("hi");
    }catch (Exception e)
    System.out.println(e.toString());
    Thanks for help!

    "local machine oracle thin driver connection;" means that my jdbc application uses Oracle thin driver to connect to a Oracle database. The database and the application are both on the same local machine.
    "lsnrctl" is the command line program running to accept incomming request to connect to the database, it listens on the default 1521 port.
    I inserted two rows into the table and I could query these two rows in SQLPLUS.
    And I tried "select ID from gameUser", "select id from scott.gameUser" and various combination, it just won't retrieve the rows I inserted in the table.

  • I am not able to run a program,please help?

    hi everybody,
    i am getting run time error when trying to run this program, what's the wrong with that
    i copied the mysql( mysql-connector-java-5.1.11-bin.jar) driver to the following:
    C:\Program Files\Java\jre1.6.0_05\lib\ext
    here is the code:
    import java.sql.*;
    public class Jdbc11 {
    public static void main(String args[]){
    System.out.println(
    "java with mysql");
    try {
    Statement stmt;
    Class.forName("com.mysql.jdbc.Driver");
    String url ="jdbc:mysql://localhost:3306/mysql";
    Connection con = DriverManager.getConnection(url,"root", "555");
    System.out.println("URL: " + url);
    System.out.println("Connection: " + con);
    stmt = con.createStatement();
    stmt.executeUpdate("CREATE DATABASE JunkDB");
    stmt.executeUpdate(
    "GRANT SELECT,INSERT,UPDATE,DELETE," +
    "CREATE,DROP " +
    "ON JunkDB.* TO 'auser'@'localhost' " +
    "IDENTIFIED BY 'drowssap';");
    con.close();
    }catch( Exception e ) {
    e.printStackTrace();
    }//end catch
    }//end main
    }//end class Jdbc11
    the error:
    C:\New Folder>java Jdbc11
    Exception in thread "main" java.lang.NoClassDefFoundError: Jdbc11
    Caused by: java.lang.ClassNotFoundException: Jdbc11
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)

    This is a sub-optimal solution. Renaming a jar file to remove version information can cause problems later. How will you know the version for which you check documentation, bugs, etc? Also, the root directory of your file system is not the best place to put java archive files. It can get pretty crowded for a complex application. I suggest you create, for your project, some directory where third-party jar files can maintained. We do this for each project.
    {?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Where to find my Serial Number for Photoshop CS6 Extended? The program has been on my computer for at least a year now and for some reason it is now requiring my serial number to run the program. Please help!

    Where to find my Serial Number for Photoshop CS6 Extended? The program has been on my computer for at least a year now and for some reason it is now requiring my serial number to run the program. Please help!

    Log in into your Adobe account and go to "My Products".  You'll find a list of all the products you've ever registered with Adobe.

  • HELP, I CANT RUN ANY JAVA PROGRAMS

    Hi again
    thank you to the people who replyed to my last post.
    i have downloaded the J2sdk1.4.0 from the sun web site and installed it but when ever i try to compile or run a programe dos says bad command or file name.
    i have included the location of the 1.4.0 on my computers path like so C:\WINDOWS;C:\WINDOWS\COMMAND;C:\PROGRA~1\PROTEC~1\j2sdk1.4.0-beta3\bin
    but my computer cant seem to find it
    can anyone at all help, it might seem silly so thats why ive posted this on a new to java forum.

    No, thats not silly ;- ). Everything looks ok. Are you sure you entered the "EXACT" path to the jdk? Everything should look like:
    SET PATH:<jdk>/bin
    Also, make sure you reboot!
    -Strider

  • Hi, Need help. I am trying to download the latest iTunes for Windows application but on running the program it says that it can not be completed as it can not find the folder location of the file "iTunes.msi" . Any clues would be appreciated

    Hi, Need help. I am trying to download the latest iTunes for Windows application but on running the program it says that it can not be completed as it can not find the folder location of the file "iTunes.msi" . Any clues would be appreciated

    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any iTunes entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?

  • Help! how to run other programs using java

    how can i run other programs or exe files using java, anyone can give sample codes for this.
    ex. if I click [run MsWord] button, then msWord automatically lunch

    RunTime.getRuntime().exec(string command)
    I guess, it might help you..java.lang.Runtime

  • Help needed to run JSTL 1.1 in Tomcat 6.0.16

    Hi All,Help needed to run JSTL 1.1 in Tomcat 6.0.16. I am trying to run the example given in http://tomcat.apache.org/tomcat-6.0-doc/jndi-datasource-examples-howto.html The example tries to connect to MySQL database from JSP using JSTL and JNDI Datasource.I am running the example using Eclipse 3.4.2 using Sysdeo plugin to start and stop Tomcat server from Eclipse IDE.
    My web.xml file has <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    </web-app>
    and test.jsp has proper taglib directives
    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
    I have placed the jstl.jar and standard.jarof the jakarta-taglibs-standard-1.1.2.zip under E:\Deepa\workspace\DBTest\WebContent\WEB-INF\lib directory also placedcontext.xml file under E:\Deepa\workspace\DBTest\WebContent\META-INF and the content of context.xml is as below
    <Context path="/DBTest" docBase="DBTest"
    debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000"
    username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>
    </Context>
    Now while running the example, Eclipse creates one DBTest.xml file under C:\Program Files\Apache Software Foundation\Tomcat 6.0\conf\Catalina\localhost
    which has the following line:
    <Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest" workDir="E:\Deepa\workspace\DBTest\work" />
    I am getting the following error when running http://localhost/DBTest/WebContent/test.jsp
    in Browser:
    <HTTP Status 500 -
    type Exception report
    message
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
    org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
    org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
    org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:315)
    org.apache.jasper.compiler.TagLibraryInfoImpl.<init>(TagLibraryInfoImpl.java:148)
    org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:431)
    org.apache.jasper.compiler.Parser.parseDirective(Parser.java:494)
    org.apache.jasper.compiler.Parser.parseElements(Parser.java:1444)
    org.apache.jasper.compiler.Parser.parse(Parser.java:138)
    org.apache.jasper.compiler.ParserController.doParse(ParserController.java:216)
    org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
    org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:154)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
    org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    In the Tomcat Server console, I am getting the following error:
    INFO: Server startup in 7295 ms
    May 20, 2009 6:36:48 AM org.apache.jasper.compiler.TldLocationsCache processWebDotXml
    WARNING: Internal Error: File /WEB-INF/web.xml not found
    May 20, 2009 6:36:48 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    org.apache.jasper.JasperException: The absolute uri: http://java.sun.com/jsp/jstl/sql cannot be resolved in either web.xml or the jar files deployed with this application
    what is the problem with my code?
    When running the same example, by creating a local server in Eclipse(creating new Server connection pointing to same Tomcat 6.0 installation) it runs fine without any error.

    Hi evnafets,
    Wow, very helpful information, great insight into working of Eclipse. Thanks a lot.
    I have one more question. I have a context.xml file under {color:#0000ff}E:\Deepa\workspace\DBTest\WebContent\META-INF{color} folder and that has the Resource element to connect to MySQL database:
    {code{color:#000000}}{color}<Context path="/DBTest" docBase="DBTest" debug="5" reloadable="true" crossContext="true">
    <Resource name="jdbc/TestDB" auth="Container" type="javax.sql.DataSource" maxActive="100" maxIdle="30" maxWait="10000" username="deepa" password="mysql" driverClassName="com.mysql.jdbc.Driver"
    {color:#0000ff}url="jdbc:mysql://localhost:3306/javatest?autoReconnect=true"/>{color}
    {color:#0000ff}</Context>{color}As usual when running application in local Tomcat server of Eclipse, this data source works fine. But when I run the application on Tomcat, by starting Sysdeo plugin from Eclipse, the DBTest.xml file created in C:\Tomcat 6.0\conf\Catalina\localhost has the context entry as<Context path="/DBTest" reloadable="true" docBase="E:\Deepa\workspace\DBTest\WebContent" workDir="E:\Deepa\workspace\DBTest\work">
    </Context>The<Resource> element I have specified in the context.xml of \WebContent\META-INF folder is not taken into account by Tomcat and it gives the following error:May 21, 2009 5:20:04 AM org.apache.catalina.core.StandardWrapperValve invoke
    SEVERE: Servlet.service() for servlet jsp threw exception
    javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "org.apache.tomcat.dbcp.dbcp.SQLNestedException_: Cannot create JDBC driver of class '' for connect URL 'null'"
    _at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(_QueryTagSupport.java:276_)
    at org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(_QueryTagSupport.java:159_)
    at org.apache.jsp.test_jsp._jspx_meth_sql_005fquery_005f0(_test_jsp.java:113_)
    at org.apache.jsp.test_jsp._jspService(_test_jsp.java:66_)
    at org.apache.jasper.runtime.HttpJspBase.service(_HttpJspBase.java:70_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.jasper.servlet.JspServletWrapper.service(_JspServletWrapper.java:374_)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(_JspServlet.java:342_)
    at org.apache.jasper.servlet.JspServlet.service(_JspServlet.java:267_)
    at javax.servlet.http.HttpServlet.service(_HttpServlet.java:717_)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(_ApplicationFilterChain.java:290_)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(_ApplicationFilterChain.java:206_)
    at org.apache.catalina.core.StandardWrapperValve.invoke(_StandardWrapperValve.java:233_)
    at org.apache.catalina.core.StandardContextValve.invoke(_StandardContextValve.java:191_)
    at org.apache.catalina.core.StandardHostValve.invoke(_StandardHostValve.java:128_)
    at org.apache.catalina.valves.ErrorReportValve.invoke(_ErrorReportValve.java:102_)
    at org.apache.catalina.core.StandardEngineValve.invoke(_StandardEngineValve.java:109_)
    at org.apache.catalina.connector.CoyoteAdapter.service(_CoyoteAdapter.java:286_)
    at org.apache.coyote.http11.Http11Processor.process(_Http11Processor.java:845_)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(_Http11Protocol.java:583_)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(_JIoEndpoint.java:447_)
    at java.lang.Thread.run(_Thread.java:619_)
    {code}
    So to overcome this error I had to place the <Resource> element in DBTest.xml under C:\Tomcat 6.0\conf\Catalina\localhost {color:#000000}and then it works fine. {color}{color:#ff0000}*Why is the context.xml file in META-INF not considered by Tomcat server using Sysdeo Plugin?*
    *Thanks,*
    *Deepa*{color}
    {color}
    Edited by: Deepa76 on May 26, 2009 9:32 PM

  • How to start JDBC program from web.

    Okay I have researched this alot on how you are suppose to connect to a database using JSP and all the example just show how to print the entire database. What I need to do is take a JDBC program I have written and make it run on a web page. How can I call the program to run on a web page. The JDBC program will search,update,add information into a database but how do I get the JDBC program run on a web server. I am a newbie in JSP.

    Then could someone tell me what is the point in learning JDBC if you can't use it for web applications? Could someone then tell me which to learn in order for me to implement using my database on the web. Should I learn how to do it as a servlet or in JSP. Which is going to require less time to learn. I am kinda in a time crunch on this one. I would really like to learn both and I will probably go back and do that but I don't have time to learn both so any advice would be helpful. Thank you for you time.

  • Could not able to RUN Java Programs in JRE 1.5.08

    hi
    I am using Jdk 1.5.8.
    I don�t have any problem in compiling the files.
    but i could not able to run the program through windows cmd prompt.
    Say name of the java file is newFile (no packages).
    When i try to run the program by using java newFile it raises a ClassNotFoundException.
    it s the same case when try to set any JDBC drivers ..
    is there any problem in my class path settings? Please help me out to fix this problem

    if your current directory is not in the classpath,you should include it in the classpath.
    To do that you can include .(dot) to your classpath variable.
    http://java.sun.com/j2se/1.3/docs/tooldocs/win32/classpath.html

  • /SAPAPO/SDRQCR21 program is not working correctly if we run the program for range of material and plant wise

    Hi APO Experts,
    In our project, we have received more sales order inconsistencies which is not clearing by CCR program and it is clearing by  program /SAPAPO/SDRQCR21 with option as Build Reqmts from Doc. Flow, So We have decided to schedule the background job on daily basis for program /SAPAPO/SDRQCR21 with option as Build Reqmts from Doc. Flow, performing the testing in our quality system and observed the below strange behavior. 
    When I am running the program /SAPAPO/SDRQCR21 with Range of products and some location range with option as Build Reqmts from Doc. Flow, in Background job. In output it is suggesting to delete one sales order. If I checked that Sales order in ECC, it is for an different location, that is not part of my selection and the order is open. In MD04 the Qty is showing 1 ( as per sales order) but in APO RRP3 view the order qty is showing Zero. I have run the CCR, it is coming in different in content and if I push, the different is not going to APO.
    I have tried running the program /SAPAPO/SDRQCR21 with plant which is mentioned in that sales order with option as Build Reqmts from Doc. Flow, in Background job , it is suggesting this sales order under update option correctly.   
    Can you please help me understand why it is behaving differently like the location is not part of my selection and why it is suggesting the wrong action. And also whether is it advisable to run the /SAPAPO/SDRQCR21 with option as Build Reqmts from Doc. Flow at plant range and material range in background job.
    Thanks & Regards,
    Sundaram Radhakrishnan

    Sundaram,
    It sounds to me like the sales document records in the OLTP and in APO were created at different times.  This is common in Dev and Qual environments when the systems are commonly created at two different times, and each was a copy of an existing system that contained sales data.  The order number you see in //rrp3 is somewhat irrelevant; system generally uses the guid for many activities.
    FYI during Dev and Qual refreshes, if you are copying from a production environment that contains data, it is always best to create the OLTP and SCM images at the same time, and to copy them both to the Dev and Qual systems at the same time.  If you don't do this, you are faced with the additional tasks associated with getting the copied systems back into synch.
    If this is Dev or Qual, I suggest that you just completely wipe out all sales orders in APO and rebuild them using the CIF.
    If this is a mature production environment, the only time I have ever seen this issue is due to improperly created CIF enhancements.  Speak to your developers to find the root cause, and correct this problem.  Then, wipe out all sales orders and rebuild with CIF.
    Best Regards,
    DB49

  • Help with resultset from jdbc

    When I run this program, the result set show up in the results textarea but it does not start a new line after each record even after inserting the "\n" escape character
    import java.awt.*;
    import java.sql.*;
    import java.awt.event.*;
    import javax.swing.*;
    * @author wezi
    * A java program for keeping track of the inventory of
    * books belonging to the ACM bookclub of Riverside
    public class ACMBooks extends JFrame
         private JTabbedPane mainTab;
         private JPanel connectpane, querypane, processpane, adminpane;
         private JPanel quadpane[] = new JPanel[4];
         //components for pane 1
         private JTextField txtUser, txtPort, txtHost, txtdb;
         private JLabel lbluser, lblpasswd, lblport, lblhost, lbldb, lblstatus;
         private JPasswordField pwdconnect;
         private JButton btnConnect ;
         private String tooltip[] = {"Default Name = bookdb","",
                   "Default port for MySQL = 3306",
                    "Default host is localhost", "Default database is acmbooks"};
         //Components for pane 2
         private JPanel sqlpane, searchpane, resultspane;
         private JTextArea txaSQL, txaResults;
         private JButton btnQuery, btnSearch, btnReset;
         private JLabel lblAuthor, lblTitle, lblISBN, lblCategory;
         private JTextField txtauthor, txttitle, txtisbn, txtCat;
         private JScrollPane scroller;
         //Components for panel 3
         private JPanel checkIn, checkOut;
         private GridLayout gl,gl2, gl3;
         private GridBagLayout gbl = new GridBagLayout();
         private GridBagConstraints gbc = new GridBagConstraints();
         private GridBagConstraints gbc2 = new GridBagConstraints();
         //private String pwd;
         //Set up the GUI
         public ACMBooks()
              super("ACM Book Library");
              lbldb = new JLabel("Database");
              lblstatus = new JLabel("Connection settings");
              gl = new GridLayout(2,2);
              Container cont = getContentPane();
              mainTab = new JTabbedPane();
              connectpane = new JPanel();
              adminpane = new JPanel();
              //set up the connection pane GUI
              connectpane.setLayout(gl);
              for(int i=0; i<4; i++)
                   quadpane[i] = new JPanel();
                   connectpane.add(quadpane);
              gbc.insets = new Insets(0,20,0,0);
              quadpane[0].setLayout(gbl);
              lbluser = new JLabel("User Name:");
              gbc.anchor = GridBagConstraints.NORTHEAST;
              gbc.gridx = 0; gbc.gridy = 0;
              gbc.weightx = 0.5; gbc.weighty = 0.5;
              quadpane[0].add(lbluser,gbc);
              lblpasswd = new JLabel("Password:");
              gbc.gridx = 0; gbc.gridy = 1;
              quadpane[0].add(lblpasswd,gbc);
              lblport = new JLabel("Port:");
              gbc.gridx = 0; gbc.gridy = 2;
              quadpane[0].add(lblport,gbc);
              lblhost = new JLabel("Host:");
              gbc.gridx = 0; gbc.gridy = 3;
              quadpane[0].add(lblhost,gbc);
              lbldb = new JLabel("Database:");
              gbc.gridx = 0; gbc.gridy = 4;
              quadpane[0].add(lbldb,gbc);
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.insets = new Insets(0,10,0,0);
              gbc.gridx = 1; gbc.gridy = 0;
              txtUser = new JTextField(10);
              txtUser.setToolTipText("Default username = bookdb");
              quadpane[0].add(txtUser,gbc);
              gbc.gridx = 1; gbc.gridy = 2;
              txtPort = new JTextField(10);
              txtPort.setToolTipText("Default port = 3306");
              quadpane[0].add(txtPort,gbc);
              gbc.gridx = 1; gbc.gridy = 3;
              txtHost = new JTextField(10);
              txtHost.setToolTipText("Default host = localhost");
              quadpane[0].add(txtHost,gbc);
              gbc.gridx = 1; gbc.gridy = 4;
              txtdb = new JTextField(10);
              txtdb.setToolTipText("Default database = acmbooks");
              quadpane[0].add(txtdb,gbc);
              pwdconnect = new JPasswordField(10);
              gbc.gridx = 1; gbc.gridy = 1;
              quadpane[0].add(pwdconnect,gbc);
              //Create a connection button
              btnConnect = new JButton("Connect");
              gbc.anchor = GridBagConstraints.NORTHWEST;
              gbc.gridx = 2; gbc.gridy = 4;
              quadpane[0].add(btnConnect,gbc);
              //create the reset button
              btnReset = new JButton(" Reset ");
              btnReset.setSize(btnConnect.getHeight(),btnConnect.getWidth());
              gbc.gridx = 2; gbc.gridy = 3;
              quadpane[0].add(btnReset,gbc);
    //Connection status
              lblstatus = new JLabel();
              quadpane[3].setLayout(gbl);
              gbc.anchor = GridBagConstraints.SOUTHEAST;
              gbc.insets = new Insets(0,10,20,20);
              quadpane[3].add(lblstatus,gbc);
              //Add a border to the first pane & add it to the main container
              quadpane[0].setBorder(BorderFactory.createTitledBorder("Details"));
              mainTab.addTab("Connection Settings",null,connectpane,"connections");
              //Create the second tab (Query pane)
              querypane = new JPanel();
              GridBagLayout gblquery= new GridBagLayout();
              GridBagConstraints gbcquery = new GridBagConstraints();
              gl2 = new GridLayout(4,1);
              querypane.setLayout(gblquery);
              //The sql query pane
              sqlpane = new JPanel();
              sqlpane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.weightx = 0.5; gbc2.weighty = 0.5;
              txaSQL = new JTextArea(4,44);
              txaSQL.setBorder(BorderFactory.createLoweredBevelBorder());
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              gbc2.insets = new Insets(0,10,0,0);
              sqlpane.add(txaSQL,gbc2);
              gbc2.gridx = 1; gbc2.gridy = 0;
              btnQuery = new JButton("Enter Query");
              gbc2.insets = new Insets(0,16,5,10);
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              sqlpane.add(btnQuery,gbc2);
              sqlpane.setBorder(BorderFactory.createTitledBorder("SQL Queries:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 0;
              gbcquery.anchor = GridBagConstraints.NORTHWEST;
              gbcquery.weightx = 0.5; gbcquery.weighty =0.5;
              gbcquery.fill =GridBagConstraints.REMAINDER;
              gbcquery.insets = new Insets(0,0,2,0);
              gbcquery.ipadx = 1; gbcquery.ipady = 1;
              querypane.add(sqlpane,gbcquery);
              //The search by pane
              searchpane = new JPanel();
              searchpane.setLayout(gbl);
              gbc2.insets = new Insets(0,14,5,5);
              lblAuthor = new JLabel("Author:");
              gbc2.anchor = GridBagConstraints.NORTHEAST;
              gbc2.gridx = 0; gbc2.gridy = 0;
              searchpane.add(lblAuthor,gbc2);
              lblTitle = new JLabel("Title:");
              gbc2.gridx = 0; gbc2.gridy = 1;
              searchpane.add(lblTitle,gbc2);
              lblISBN = new JLabel("ISBN:");
              gbc2.gridx = 2; gbc2.gridy = 0;
              searchpane.add(lblISBN,gbc2);
              lblCategory = new JLabel("Category:");
              gbc2.gridx = 2; gbc2.gridy =1;
              searchpane.add(lblCategory,gbc2);
              txtauthor = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              searchpane.add(txtauthor,gbc2);
              txttitle = new JTextField(15);
              gbc2.gridx = 1; gbc2.gridy = 1;
              searchpane.add(txttitle,gbc2);
              txtisbn = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 0;
              searchpane.add(txtisbn,gbc2);
              txtCat = new JTextField(15);
              gbc2.gridx = 3; gbc2.gridy = 1;
              searchpane.add(txtCat,gbc2);
              btnSearch = new JButton("Search >>>");
              gbc2.anchor = GridBagConstraints.SOUTHEAST;
              gbc2.gridx = 4; gbc2.gridy = 1;
              gbc2.insets = new Insets(0,5,20,10);
              searchpane.add(btnSearch,gbc2);
              searchpane.setBorder(BorderFactory.createTitledBorder("Search By:"));
              gbcquery.gridheight =1; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 1;
              gbcquery.insets = new Insets(0,0,0,0);
              querypane.add(searchpane,gbcquery);
              //The results pane
              resultspane = new JPanel();
              resultspane.setSize(20,60);
              resultspane.setLayout(gbl);
              gbc2.gridx = 0; gbc2.gridy = 0;
              gbc2.anchor = GridBagConstraints.NORTHWEST;
              txaResults = new JTextArea(" ",9,55);
              scroller = new JScrollPane(txaResults);
              resultspane.add(new JScrollPane(txaResults));
              txaResults.setBorder(BorderFactory.createLoweredBevelBorder());
              resultspane.add(txaResults,gbc2);
              resultspane.setBorder(BorderFactory.createTitledBorder("Results:"));
              gbcquery.gridheight =3; gbcquery.gridwidth = 1;
              gbcquery.gridx = 0; gbcquery.gridy = 2;
              gbcquery.weightx = 1; gbcquery.weighty = 1;
              querypane.add(resultspane,gbcquery);
              mainTab.addTab("Query Entry",null,querypane,"Query page");
              //Create a third tab to process book checkin and out
              processpane = new JPanel();
              gl3 = new GridLayout(4,1);
              processpane.setLayout(gl3);
              //Create the checkin panel
              checkIn = new JPanel();
              checkIn.setBorder(BorderFactory.createTitledBorder("Return Books"));
              checkIn.setLayout(gbl);
              //Create the checkout panel
              checkOut = new JPanel();
              checkOut.setBorder(BorderFactory.createTitledBorder("Check Books Out"));
              processpane.add(checkOut,gl3);
              processpane.add(checkIn,gl3);
              mainTab.addTab("Process Books",null, processpane,"Book Processing page");
              //Create an administration panel
              adminpane = new JPanel();
              mainTab.addTab("Admin",null,adminpane,"Administration page");
              cont.add(mainTab);
              //Register the eventhandlers
              ButtonHandler btnHandler = new ButtonHandler();
              btnConnect.addActionListener(btnHandler);
              btnQuery.addActionListener(btnHandler);
              btnSearch.addActionListener(btnHandler);
              btnReset.addActionListener(btnHandler);
              setSize(650,460);
              setVisible(true);
         }//end constructor
         private class ButtonHandler implements ActionListener
              public void actionPerformed(ActionEvent e)
                   String errMsg;
                   Statement stmt;
                   ResultSet rs;
                   Connection con = null;
                   String pwd;
                   String user;
                   //Create a url from user input
                   String url = "jdbc:mysql://";
                   url += txtHost.getText();
                   url += ":";
                   url += txtPort.getText();
                   url += "/";
                   url += txtdb.getText();
              try
                   //Register the JDBC Mysql Driver
                   Class.forName("com.mysql.jdbc.Driver");
                   //Get the password and user name for the database
                   pwd = new String(pwdconnect.getPassword());
                   user = new String(txtUser.getText());
                   //Open a connection to the database
                   con = DriverManager.getConnection(url,user,pwd);
                        //Add the action event for the btnReset
                        if(e.getSource() == btnReset)
                             //Clear all the text fields and the status label
                             lblstatus.setText(" ");
                             txtUser.setText(" ");
                             txtdb.setText(" ");
                             txtHost.setText(" ");
                             txtPort.setText(" ");
                             pwdconnect.setText("");
                             txaResults.setText(" ");
                             txaSQL.setText(" ");
                             try{
                                  if(!con.isClosed())
                                       con.close();
                             catch(Exception closeError)
                                  String clErr = new String(closeError.toString());
                                  txaResults.setText(clErr);
                        }//end btnReset
                   //If the connect button is pressed
                   if(e.getSource() == btnConnect)
                   if(!con.isClosed())//if connection is open
                        lblstatus.setText("");
                        lblstatus.setVisible(true);
                        lblstatus.setText("Connected to " + txtdb.getText()
                             +" on "     + txtHost.getText());
                   else
                   { lblstatus.setText("Not Connected"); }
                   }//end btnConnect
                   if(e.getSource() == btnQuery || e.getSource()== txaSQL)
                        String strQuery = new String(txaSQL.getText());
                        ResultSetMetaData rsmtd;
                        int numCol;
                        try
                             stmt = con.createStatement();
                             rs = stmt.executeQuery(strQuery);
                             rsmtd = rs.getMetaData(); //to get metadata
                             numCol = rsmtd.getColumnCount(); //for number of columns
                             String strCol[] = new String[numCol];
                             String colName[] = new String[numCol];
                             String txaColumn = new String("");
                             String strHeading = new String("");
                             //Write the results of the query to the results text area
                             txaResults.setText(" ");          
                             //Get the data from the result set
                             //first get the column headings
                             for(int i=1; i<=numCol; i++)
                                  colName[i-1] = rsmtd.getColumnName(i);
                                  strHeading += colName[i-1] + "\t";
                             txaResults.setText(strHeading + "\n");
                             while(rs.next())
                                  //Get the values & create a display column
                                  for(int i=1; i<=numCol; i++)
                                       strCol[i-1] = rs.getString(i);
                                       txaColumn += strCol[i-1] + "\t";
                                  }//end for
                                  //Display the values
                                  txaResults.append( txaColumn + "\n");
                        catch(Exception sqlError)
                             txaResults.setText("");
                             String strSqlErr = new String(sqlError.toString());
                             txaResults.setText(strSqlErr);
                   }//end btnQuery
                   if(e.getSource() == btnSearch)
                        try
                             String strAuthor = new String(txtauthor.getText());
                             String strISBN = new String(txtisbn.getText());
                             String strTitle = new String(txttitle.getText());
                             String strCat = new String(txtCat.getText());
                             * Need to add code to change the search fields to
                             * any if the field is blank i.e if the field is blank
                             * search using a wild card. If all fields are blank, then
                             * do not search at all.
                             stmt = con.createStatement();
                             rs = stmt.executeQuery("Select * from books where" +
                                       " bookAuthor = " + strAuthor +
                                       " bookISBN = " + strISBN +
                                       " bookTitle = " + strTitle +
                                       "bookCategory = " + strCat);
                        catch(Exception searchError)
                             errMsg = new String(searchError.toString());
                             txaResults.setText("");
                             txaResults.setText(errMsg);
                   }//end btnSearch
              catch(Exception connectError)
                   errMsg = new String(connectError.toString());
                   lblstatus.setText("");
                   lblstatus.setText(errMsg);
              }//end actionPer
         }//end ButtonHandler
         public static void main(String[] args)
              ACMBooks app = new ACMBooks();
              app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
         }//end main
    }//end class ACMBooks

    Hi,
    Here is a template of Manifest file which you can use for your reference:
    Manifest-Version: 1.0
    Created-By: Apache Ant 1.5.1
    Main-Class: com.pkg1.pkg2.MainClass
    Class-Path: . ./libs/ ./libs/database-driver.jar ./libs/jdom.jar ./libs/xercesImpl.jar ./libs/log4j.jar ....
    Name: com.pkg1.pkg2Main-Class: Specify the main class with complete package name
    Class-Path: Put all the jar file name with path
    <b>So the solution to your problem is to put you jar file name with the relative or complete path</b>
    Thanks
    Duke.

  • Error in running the Program SDRQCR21

    Hi,
    For a material,the sales order which are rejected are showning in MD04.When i try to run this program
    SDRQCR21,it gives me timed out error.
    Since there are lot of sales order for that material.
    Please can any one help me in this issue...
    Thanks
    Srini

    Hi,
    If we run the program,is the orders which are rejected gets deleted or any other scenario like delivery not created for the order etc will also get deleted from the MD04.
    Please clarify on this issue.
    Thanks
    Srini

  • Getting an error when running my program but it compiles.

    Hey guys, I'm having a problem running the program. Everything compiles correctly, but then I get the error code linked below. Everything I think is correct here. Any ideas? I posted CinReader as well in case you wanted to try compiling and running it yourself.
    Thanks
    public class TextShuffleLevel
         private String jumble;
         private String [] matchString;
         public TextShuffleLevel ()
              jumble = "dunops";
              matchString = new String[5];
              matchString[0] = new String("abound");
              matchString[1] = new String("bound");
              matchString[2] = new String("undo");
              matchString[3] = new String("band");
              matchString[4] = new String("bond");
         public TextShuffleLevel (int whichDefaultLevel)
              if (whichDefaultLevel == 1)
                   jumble = "dunops";
                   matchString = new String[5];
                   matchString[0] = new String("abound");
                   matchString[1] = new String("bound");
                   matchString[2] = new String("undo");
                   matchString[3] = new String("band");
                   matchString[4] = new String("bond");
              else if (whichDefaultLevel == 2)
                   jumble = "srcaso";
                   matchString = new String[11];
                   matchString[0] = new String("across");
                   matchString[1] = new String("crass");
                   matchString[2] = new String("cross");
                   matchString[3] = new String("scars");
                   matchString[4] = new String("soars");
                   matchString[5] = new String("arcs");
                   matchString[6] = new String("soar");
                   matchString[7] = new String("scar");
                   matchString[8] = new String("oars");
                   matchString[9] = new String("cars");
                   matchString[10] = new String("orcs");
              else
                   jumble = "eplcis";
                   matchString = new String[19];
                   matchString[0] = new String("splice");
                   matchString[1] = new String("spiel");
                   matchString[2] = new String("plies");
                   matchString[3] = new String("slice");
                   matchString[4] = new String("clips");
                   matchString[5] = new String("epics");
                   matchString[6] = new String("spice");
                   matchString[7] = new String("epic");
                   matchString[8] = new String("lice");
                   matchString[9] = new String("slip");
                   matchString[10] = new String("clip");
                   matchString[11] = new String("pile");
                   matchString[12] = new String("lisp");
                   matchString[13] = new String("pies");
                   matchString[14] = new String("isle");
                   matchString[15] = new String("lips");
                   matchString[16] = new String("lies");
                   matchString[17] = new String("ices");
                   matchString[18] = new String("pics");
         public TextShuffleLevel (String newJumble, String [] newMatchString)
              jumble = newJumble;
              matchString = newMatchString;
         /* This is the nasty one */
         public boolean findMatch (String matchTry)
              boolean foundMatch = false;
              for (int i=0; i<matchString.length; i++)
                   if (matchTry.equalsIgnoreCase(matchString))
                        foundMatch = true;
                        break;
              return foundMatch;
         public void setJumble (String newJumble)
              jumble = newJumble;
         public void setMatchStrings (String [] newMatchString)
              matchString = newMatchString;
         public String getJumble ()
              return jumble;
         public int getJumbleLength ()
              return jumble.length();
         public int getNumberOfMatches ()
              return matchString.length;
         public String[] getMatchString ()
              return matchString;
    public class TextShuffleGame
         private int playerLevel = 1; // start them on level 1
         private CinReader reader;
         private TextShuffleLevel l1;
         private TextShuffleLevel l2;
         private TextShuffleLevel l3;
         private TextShuffleLevel onTheFly;
         public TextShuffleGame ()
              reader = new CinReader();
              // Using Statically Set Levels
              l1 = new TextShuffleLevel(1);
              l2 = new TextShuffleLevel(2);
              l3 = new TextShuffleLevel(3);
              // this one allows for a 'custom' level
              String fly[] = {"tea","at", "ate"};
              onTheFly = new TextShuffleLevel("eta", fly);
         //Setup for levels
         public void go ()
              boolean quit = false;
              char choice = 'z';
              int lastLevel = 0;
              while (quit == false)
                   lastLevel = playerLevel;
                   if (playerLevel == 1)
                        play(l1);
                   else if (playerLevel == 2)
                        play(l2);
                   else if (playerLevel == 3)
                        play(l3);
                   else
                        play(onTheFly);
                   if (lastLevel == playerLevel)
                        System.out.print("Play the level again");
                   else
                        System.out.print("Play next level");
                   System.out.print("(y/n)? ");
                   choice = reader.readChar();
                   if (choice == 'N' || choice == 'n')
                        quit = true;
         //Playing each level the same
         public void play (TextShuffleLevel theLevel)
              int numGuesses = 0;
              int numCorrect = 0;
              String userString = "";
              System.out.println("What " + theLevel.getJumbleLength() + "-letter words can you get out of " +
                                                 theLevel.getJumble() + "?\n");
              while (numGuesses < 5 && numCorrect < theLevel.getNumberOfMatches())
                        System.out.print("Enter a string: ");
                        userString = reader.readString();
                        if (theLevel.findMatch(userString) == true)
                             System.out.println("Great! A match!");
                             numCorrect = numCorrect + 1;
                        else
                             System.out.println("Drat... not a match");
                             numGuesses = numGuesses + 1;
              if (numCorrect == theLevel.getNumberOfMatches())
                   System.out.println("Terrific! You are ready to try a harder jumble");
                   playerLevel = playerLevel + 1;
         /* FOR TESTING ONLY -- TO BE REMOVED FOR RELEASE */
         public static void main (String [] args)
              TextShuffleGame tsg = new TextShuffleGame();
              tsg.go();
    import java.io.*;
    import java.util.*;
    public class CinReader
         private static final int INT_MESSAGE = 0;
         private static final int DOUBLE_MESSAGE = 1;
         private static final int CHAR_MESSAGE = 2;
         private static final int STRING_MESSAGE = 3;
         private static final int BOOLEAN_MESSAGE = 4;
         private static final String DEFAULT_ERROR_MESSAGE = "Please reenter. ";
         private String prompt = "> ";
         private String [] errorMessages;
         public CinReader ()
              prompt = "> ";
              setDefaultMessages();
         public CinReader (String newPrompt)
              prompt = newPrompt;
              setDefaultMessages();
         public CinReader (String newPrompt, String [] newErrorMessages)
              prompt = newPrompt;
              if (newErrorMessages != null)
                   setErrorMessages(newErrorMessages);
              else
                   setDefaultMessages();
         public void setPrompt (String newPrompt)
              prompt = newPrompt;
         public void setErrorMessages (String [] newErrorMessages)
              if (newErrorMessages != null)
                   int diff = errorMessages.length - newErrorMessages.length;
                   // NEED A MINIMUM OF 5 ERROR MESSAGES TO AVOID ERRORS
                   if (diff > 0)
                        errorMessages = new String[5];
                        for (int i=0; i<5; i++)
                             if (i < newErrorMessages.length)
                                  errorMessages[i] = new String(newErrorMessages);
                             else
                                  errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
                   else
                        errorMessages = newErrorMessages;
         public void setErrorMessage (int idx, String msg)
              if (idx >= 0 && idx < errorMessages.length)
                   errorMessages[idx] = msg;
         public void setErrorMessageString (String msg)
              errorMessages[STRING_MESSAGE] = msg;
         public void setErrorMessageInt (String msg)
              errorMessages[INT_MESSAGE] = msg;
         public void setErrorMessageDouble (String msg)
              errorMessages[DOUBLE_MESSAGE] = msg;
         public void setErrorMessageChar (String msg)
              errorMessages[CHAR_MESSAGE] = msg;
         public void setErrorMessageBoolean (String msg)
              errorMessages[BOOLEAN_MESSAGE] = msg;
         public String readString()
              char theChar = 'x';
              String result = "";
              boolean done = false;
              while (!done)
                   theChar = nextChar();
                   if (theChar == '\n')
                        done = true;
                   else if (theChar == '\r'){}
                   else
                        result = result + theChar;
              return result;
         public String readString (boolean allowEmpty)
              String result = readString();
              if (!allowEmpty)
                   while (result.length() == 0)
                        System.out.println("Empty input not allowed. " + errorMessages[STRING_MESSAGE]);
                        System.out.print(prompt);
                        result = readString();
              return result;
         public String readString (int charLimit)
              String result = readString();
              if (result.length() > charLimit)
                   result = result.substring(0, charLimit);
              return result;
         public String readString (boolean allowEmpty, int charLimit)
              String result = readString(allowEmpty);
              if (result.length() > charLimit)
                   result = result.substring(0, charLimit);
              return result;
         public int readInt()
              String inputString = "";
              int number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Integer.valueOf(inputString).intValue());
                        done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public int readInt(int min, int max)
              String inputString = "";
              int number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Integer.valueOf(inputString).intValue());
                        if (number < min || number > max)
                             System.out.println("Please enter an integer between " + min + " and " + max);
                        else
                             done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public double readDouble()
              String inputString = "";
              double number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Double.valueOf(inputString).doubleValue());
                        done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[DOUBLE_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public char readChar()
              boolean done = false;
              String inputString = "";
              char nonWhite = 'x';
              while (!done)
                   inputString = readString();
                   inputString = inputString.trim();
                   if (inputString.length() != 1)
                        System.out.println("Input must be a single character. " + errorMessages[CHAR_MESSAGE]);
                        System.out.print(prompt);
    else
    nonWhite = (inputString.charAt(0));
    done = true;
              return nonWhite;
         public char readChar (String range)
              char theChar = 'x';
              boolean done = false;
              while (!done)
                   theChar = readChar();
                   for (int i=0; i<range.length(); i++)
                        if (theChar == range.charAt(i))
                             done = true;
                             break;
                   if (!done)
                        System.out.print("Invalid input. Please enter one of the following -> ");
                        for (int i=0; i<range.length(); i++)
                             System.out.print(range.charAt(i) + " ");
                        System.out.print("\n" + prompt);
              return theChar;
         public boolean readBoolean()
              boolean done = false;
              String inputString = "";
              boolean result = false;
              while (!done)
                   inputString = readString(false);
                   inputString = inputString.trim();
                   if (inputString.equalsIgnoreCase("true") || inputString.equalsIgnoreCase("t"))
                        result = true;
                        done = true;
                   else if (inputString.equalsIgnoreCase("false") || inputString.equalsIgnoreCase("f"))
                        result = false;
                        done = true;
                   else
                        System.out.println("Input must be [t]rue or [f]alse. " + errorMessages[BOOLEAN_MESSAGE]);
                        System.out.print(prompt);
              return result;
         private void setDefaultMessages ()
              errorMessages = new String[5];
              for (int i=0; i<errorMessages.length; i++)
                   errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
         private char nextChar()
              int charAsInt = -1;
              try
                   charAsInt = System.in.read();
              catch(IOException e)
                   System.out.println(e.getMessage());
                   System.out.println("Fatal error. Exiting program.");
                   System.exit(0);
              return (char)charAsInt;

    Ok, here's what I did using the JSE 8.1 IDE.
    1) I copied your code into a .java file named "TextShuffleGame".
    It generated about half a dozon errors.
    There are three classes in the program:
    TextShuffleLevel
    TextShuffleGame
    CinReader
    Each of these classes is declared "public" and I got the same error message on each one:
    "class ... is public, should be declared in a file name ... .java"
    so, I...
    2) tried changing them to "private".
    It then said: "modifier private not allowed here".
    so, I...
    3) deleted the modifiers for these three classes and left them as just class. No errors.
    The next two errors had to do with the two import statements:
    "import java.io.*;" and "import java.util.*;".
    It said: "'class' or 'identifier' expected" for both. So, I...
    4) moved them to the top of the source file.
    Didn't help at first. So, I...
    5) fiddle around with them a bit.
    I tried "java.io;" and "java.util;" and then "java.*;" by itself. Still got errors. So, I put them back as you had them and for some mysterious reason, my editor decided they were fine. oO
    This also corrected the last errors in the "CinReader" class. Here is the error-free code I now have in my "TextShuffleGame.java" file:
    import java.io.*;
    import java.util.*;
    class TextShuffleLevel
         private String jumble;
         private String [] matchString;
         public TextShuffleLevel ()
              jumble = "dunops";
              matchString = new String[5];
              matchString[0] = new String("abound");
              matchString[1] = new String("bound");
              matchString[2] = new String("undo");
              matchString[3] = new String("band");
              matchString[4] = new String("bond");
         public TextShuffleLevel (int whichDefaultLevel)
              if (whichDefaultLevel == 1)
                   jumble = "dunops";
                   matchString = new String[5];
                   matchString[0] = new String("abound");
                   matchString[1] = new String("bound");
                   matchString[2] = new String("undo");
                   matchString[3] = new String("band");
                   matchString[4] = new String("bond");
              else if (whichDefaultLevel == 2)
                   jumble = "srcaso";
                   matchString = new String[11];
                   matchString[0] = new String("across");
                   matchString[1] = new String("crass");
                   matchString[2] = new String("cross");
                   matchString[3] = new String("scars");
                   matchString[4] = new String("soars");
                   matchString[5] = new String("arcs");
                   matchString[6] = new String("soar");
                   matchString[7] = new String("scar");
                   matchString[8] = new String("oars");
                   matchString[9] = new String("cars");
                   matchString[10] = new String("orcs");
              else
                   jumble = "eplcis";
                   matchString = new String[19];
                   matchString[0] = new String("splice");
                   matchString[1] = new String("spiel");
                   matchString[2] = new String("plies");
                   matchString[3] = new String("slice");
                   matchString[4] = new String("clips");
                   matchString[5] = new String("epics");
                   matchString[6] = new String("spice");
                   matchString[7] = new String("epic");
                   matchString[8] = new String("lice");
                   matchString[9] = new String("slip");
                   matchString[10] = new String("clip");
                   matchString[11] = new String("pile");
                   matchString[12] = new String("lisp");
                   matchString[13] = new String("pies");
                   matchString[14] = new String("isle");
                   matchString[15] = new String("lips");
                   matchString[16] = new String("lies");
                   matchString[17] = new String("ices");
                   matchString[18] = new String("pics");
         public TextShuffleLevel (String newJumble, String [] newMatchString)
              jumble = newJumble;
              matchString = newMatchString;
         /* This is the nasty one */
         public boolean findMatch (String matchTry)
              boolean foundMatch = false;
              for (int i=0; i<matchString.length; i++)
                   if (matchTry.equalsIgnoreCase(matchString))
                        foundMatch = true;
                        break;
              return foundMatch;
         public void setJumble (String newJumble)
              jumble = newJumble;
         public void setMatchStrings (String [] newMatchString)
              matchString = newMatchString;
         public String getJumble ()
              return jumble;
         public int getJumbleLength ()
              return jumble.length();
         public int getNumberOfMatches ()
              return matchString.length;
         public String[] getMatchString ()
              return matchString;
    class TextShuffleGame
         private int playerLevel = 1; // start them on level 1
         private CinReader reader;
         private TextShuffleLevel l1;
         private TextShuffleLevel l2;
         private TextShuffleLevel l3;
         private TextShuffleLevel onTheFly;
         public TextShuffleGame ()
              reader = new CinReader();
              // Using Statically Set Levels
              l1 = new TextShuffleLevel(1);
              l2 = new TextShuffleLevel(2);
              l3 = new TextShuffleLevel(3);
              // this one allows for a 'custom' level
              String fly[] = {"tea","at", "ate"};
              onTheFly = new TextShuffleLevel("eta", fly);
         //Setup for levels
         public void go ()
              boolean quit = false;
              char choice = 'z';
              int lastLevel = 0;
              while (quit == false)
                   lastLevel = playerLevel;
                   if (playerLevel == 1)
                        play(l1);
                   else if (playerLevel == 2)
                        play(l2);
                   else if (playerLevel == 3)
                        play(l3);
                   else
                        play(onTheFly);
                   if (lastLevel == playerLevel)
                        System.out.print("Play the level again");
                   else
                        System.out.print("Play next level");
                   System.out.print("(y/n)? ");
                   choice = reader.readChar();
                   if (choice == 'N' || choice == 'n')
                        quit = true;
         //Playing each level the same
         public void play (TextShuffleLevel theLevel)
              int numGuesses = 0;
              int numCorrect = 0;
              String userString = "";
              System.out.println("What " + theLevel.getJumbleLength() + "-letter words can you get out of " +
                                                 theLevel.getJumble() + "?\n");
              while (numGuesses < 5 && numCorrect < theLevel.getNumberOfMatches())
                        System.out.print("Enter a string: ");
                        userString = reader.readString();
                        if (theLevel.findMatch(userString) == true)
                             System.out.println("Great! A match!");
                             numCorrect = numCorrect + 1;
                        else
                             System.out.println("Drat... not a match");
                             numGuesses = numGuesses + 1;
              if (numCorrect == theLevel.getNumberOfMatches())
                   System.out.println("Terrific! You are ready to try a harder jumble");
                   playerLevel = playerLevel + 1;
         /* FOR TESTING ONLY -- TO BE REMOVED FOR RELEASE */
         public static void main (String [] args)
              TextShuffleGame tsg = new TextShuffleGame();
              tsg.go();
    class CinReader
         private static final int INT_MESSAGE = 0;
         private static final int DOUBLE_MESSAGE = 1;
         private static final int CHAR_MESSAGE = 2;
         private static final int STRING_MESSAGE = 3;
         private static final int BOOLEAN_MESSAGE = 4;
         private static final String DEFAULT_ERROR_MESSAGE = "Please reenter. ";
         private String prompt = "> ";
         private String [] errorMessages;
         public CinReader ()
              prompt = "> ";
              setDefaultMessages();
         public CinReader (String newPrompt)
              prompt = newPrompt;
              setDefaultMessages();
         public CinReader (String newPrompt, String [] newErrorMessages)
              prompt = newPrompt;
              if (newErrorMessages != null)
                   setErrorMessages(newErrorMessages);
              else
                   setDefaultMessages();
         public void setPrompt (String newPrompt)
              prompt = newPrompt;
         public void setErrorMessages (String [] newErrorMessages)
              if (newErrorMessages != null)
                   int diff = errorMessages.length - newErrorMessages.length;
                   // NEED A MINIMUM OF 5 ERROR MESSAGES TO AVOID ERRORS
                   if (diff > 0)
                        errorMessages = new String[5];
                        for (int i=0; i<5; i++)
                             if (i < newErrorMessages.length)
                                  errorMessages[i] = new String(newErrorMessages[i]);
                             else
                                  errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
                   else
                        errorMessages = newErrorMessages;
         public void setErrorMessage (int idx, String msg)
              if (idx >= 0 && idx < errorMessages.length)
                   errorMessages[idx] = msg;
         public void setErrorMessageString (String msg)
              errorMessages[STRING_MESSAGE] = msg;
         public void setErrorMessageInt (String msg)
              errorMessages[INT_MESSAGE] = msg;
         public void setErrorMessageDouble (String msg)
              errorMessages[DOUBLE_MESSAGE] = msg;
         public void setErrorMessageChar (String msg)
              errorMessages[CHAR_MESSAGE] = msg;
         public void setErrorMessageBoolean (String msg)
              errorMessages[BOOLEAN_MESSAGE] = msg;
         public String readString()
              char theChar = 'x';
              String result = "";
              boolean done = false;
              while (!done)
                   theChar = nextChar();
                   if (theChar == '\n')
                        done = true;
                   else if (theChar == '\r'){}
                   else
                        result = result + theChar;
              return result;
         public String readString (boolean allowEmpty)
              String result = readString();
              if (!allowEmpty)
                   while (result.length() == 0)
                        System.out.println("Empty input not allowed. " + errorMessages[STRING_MESSAGE]);
                        System.out.print(prompt);
                        result = readString();
              return result;
         public String readString (int charLimit)
              String result = readString();
              if (result.length() > charLimit)
                   result = result.substring(0, charLimit);
              return result;
         public String readString (boolean allowEmpty, int charLimit)
              String result = readString(allowEmpty);
              if (result.length() > charLimit)
                   result = result.substring(0, charLimit);
              return result;
         public int readInt()
              String inputString = "";
              int number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Integer.valueOf(inputString).intValue());
                        done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public int readInt(int min, int max)
              String inputString = "";
              int number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Integer.valueOf(inputString).intValue());
                        if (number < min || number > max)
                             System.out.println("Please enter an integer between " + min + " and " + max);
                        else
                             done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[INT_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public double readDouble()
              String inputString = "";
              double number = 0;
              boolean done = false;
              while (!done)
                   try
                        inputString = readString();
                        inputString = inputString.trim();
                        number = (Double.valueOf(inputString).doubleValue());
                        done = true;
                   catch (NumberFormatException e)
                        System.out.println("Input is not an integer. " + errorMessages[DOUBLE_MESSAGE]);
                        System.out.print(prompt);
              return number;
         public char readChar()
              boolean done = false;
              String inputString = "";
              char nonWhite = 'x';
              while (!done)
                   inputString = readString();
                   inputString = inputString.trim();
                   if (inputString.length() != 1)
                        System.out.println("Input must be a single character. " + errorMessages[CHAR_MESSAGE]);
                        System.out.print(prompt);
    else
    nonWhite = (inputString.charAt(0));
    done = true;
              return nonWhite;
         public char readChar (String range)
              char theChar = 'x';
              boolean done = false;
              while (!done)
                   theChar = readChar();
                   for (int i=0; i<range.length(); i++)
                        if (theChar == range.charAt(i))
                             done = true;
                             break;
                   if (!done)
                        System.out.print("Invalid input. Please enter one of the following -> ");
                        for (int i=0; i<range.length(); i++)
                             System.out.print(range.charAt(i) + " ");
                        System.out.print("\n" + prompt);
              return theChar;
         public boolean readBoolean()
              boolean done = false;
              String inputString = "";
              boolean result = false;
              while (!done)
                   inputString = readString(false);
                   inputString = inputString.trim();
                   if (inputString.equalsIgnoreCase("true") || inputString.equalsIgnoreCase("t"))
                        result = true;
                        done = true;
                   else if (inputString.equalsIgnoreCase("false") || inputString.equalsIgnoreCase("f"))
                        result = false;
                        done = true;
                   else
                        System.out.println("Input must be [t]rue or [f]alse. " + errorMessages[BOOLEAN_MESSAGE]);
                        System.out.print(prompt);
              return result;
         private void setDefaultMessages ()
              errorMessages = new String[5];
              for (int i=0; i < errorMessages.length; i++)
                   errorMessages[i] = new String(DEFAULT_ERROR_MESSAGE);
         private char nextChar()
              int charAsInt = -1;
              try
                   charAsInt = System.in.read();
              catch(IOException e)
                   System.out.println(e.getMessage());
                   System.out.println("Fatal error. Exiting program.");
                   System.exit(0);
              return (char)charAsInt;
    Hope that helps.

Maybe you are looking for

  • I accidently deleated file from the Elements organizor and from the hard drive. Can I get it back?

    I accidently deleated a file from the Elements organizor and from the hard drive. Can I get it back? How to do it?

  • Error RFC to SOAP Scenario

    Hi Experts, I am getting an error while dealing with RFC to SOAP scenario:: soap fault: System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: . at System.Web.Services.Protocols.Soap11ServerProtocol

  • Help! Compiling error

    Hello guys! I',m having this bizare compiling error in the following code: Stirng test = "Test ; test ; test"; String[] tests = test.split(";"); System.out.printLine(tests.lengh());First off it highlights tests.length() and says in cannot find symbol

  • [SOLVED] yaourt bug (error: target not found: [b]I )

    subj, after install and uninstall xampp yaourt -S xampp ==> Installing from a package list Пароль: error: target not found: {b}I *in quote changed [] to [] maybe clear package list? I tried: yaourt -Syu yaourt -Syua yaourt -Scc rm /tmp/yaourt-tmp-$US

  • Is it possible to save user settings to database?

    hi, gurus, we have a complex program with many fields on the selection screen. it's not possible to save variants as reports. i want to know is it possible to save user entered data into database(cluster table maybe), so next time when user open th e