Plz help me with this data insertion code

Hi,
I am listing a code below ,I am able to insert only one row of value.
Then i get SQLException.General Exception and a Lock record MSAccess file is generated where .mdb file is stored.
public void throwtodatabase()
String gameid;
ResultSet rs=null;
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
Statement stat3=con.createStatement();
rs=stat3.executeQuery("select * from sudoko");
while (rs.next()) {
pctr=pctr+1;
stat3.close();
con.close();
catch(Exception g)
JFrame ob2=new JFrame();
JOptionPane.showMessageDialog(ob2,g.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
try
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con;
con=DriverManager.getConnection ("jdbc:odbc:MyData","","");
gameid="G00"+String.valueOf(pctr);
PreparedStatement stat=null;
for (int t1=1;t1<=9;t1++) {
for (int t2=1;t2<=9;t2++) {
stat=con.prepareStatement("Insert into Sudoko(gameid,row,col,val) values(?,?,?,?)");
stat.setString(1,gameid);
stat.setString(2,String.valueOf(t1));
stat.setString(3,String.valueOf(t2));
stat.setString(4,String.valueOf(array_map[t1][t2]));
stat.execute();
con.close();
catch(Exception xd)
JFrame ob2=new JFrame();
JOptionPane.showMessageDialog(ob2,xd.toString(), "Message", JOptionPane.INFORMATION_MESSAGE);
}Plz help.Thanx in advance.

Have this stacktrace
java.sql.SQLException: General error
at sun.jdbc.odbc.JdbcOdbc.createSQLException(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.standardError(Unknown Source)
at sun.jdbc.odbc.JdbcOdbc.SQLExecute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.execute(Unknown Source)
at sun.jdbc.odbc.JdbcOdbcPreparedStatement.executeUpdate(Unknown Source)
at Sudoko.throwtodatabase(Sudoko.java:1120)
at Sudoko.generate_random_boards(Sudoko.java:1064)
at Sudoko.actionPerformed(Sudoko.java:205)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
n Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour
ce)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Similar Messages

  • Plz help me with this requirement

    hi to all,
    i have designed a module pool program
    in first screen i have 2 pushbutton (screen no 100)
    when i click on first button i will goto screen 1001 i.e vendor details
    when i click on second button i will goto screen 2001 where i get vendor bank details
    my requirement is that in second screen when i click a button. it display TABLE CONTROL with all the bank details for that vendor
    how to implement it
    help me out
    here is my code
    INCLUDE ZB14HAI_MP1_TOP . " global Data
    INCLUDE ZB14HAI_MP1_O01 . " PBO-Modules
    INCLUDE ZB14HAI_MP1_I01 . " PAI-Modules
    INCLUDE ZB14HAI_MP1_F01
    *& Include ZB14HAI_MP1_TOP Module pool ZB14HAI_MP1
    PROGRAM ZB14HAI_MP1 MESSAGE-ID MSGCLASS.
    tables: lfa1,lfbk.
    data:ok_code type sy-ucomm.
    data : it_bank type table of lfbk,
    wa_bank like line of it_bank.
    CONTROLS TBCL_4000 TYPE TABLEVIEW USING SCREEN 4000.
    *& Include ZB14HAI_MP1_O01
    *& Module STATUS_0100 OUTPUT
    text
    MODULE STATUS_0100 OUTPUT.
    SET PF-STATUS 'ZBPF_STATUS1'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_0100 OUTPUT
    *& Module STATUS_2001 OUTPUT
    text
    MODULE STATUS_2001 OUTPUT.
    SET PF-STATUS 'ZBPF_STATUS2'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_2001 OUTPUT
    *& Module STATUS_4000 OUTPUT
    text
    MODULE STATUS_4000 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    ENDMODULE. " STATUS_4000 OUTPUT
    *& Module DISPLAY_TBCL_4000 OUTPUT
    text
    MODULE DISPLAY_TBCL_4000 OUTPUT.
    LFBK-LIFNR = WA_BANK-LIFNR.
    LFBK-BANKS = WA_BANK-BANKS.
    LFBK-BANKL = WA_BANK-BANKL.
    LFBK-KOINH = WA_BANK-KOINH.
    LFBK-EBPP_ACCNAME = WA_BANK-EBPP_ACCNAME.
    ENDMODULE. " DISPLAY_TBCL_4000 OUTPUT
    *& Include ZB14HAI_MP1_I01
    *& Module USER_COMMAND_0100 INPUT
    text
    MODULE USER_COMMAND_0100 INPUT.
    CASE OK_CODE.
    WHEN 'EXIT'.
    LEAVE PROGRAM.
    WHEN'VEND'.
    CALL SCREEN 1001.
    WHEN 'BANK'.
    CALL SCREEN '2001'.
    ENDCASE.
    ENDMODULE.
    " USER_COMMAND_0100 INPUT
    *& Module USER_COMMAND_1001 INPUT
    text
    MODULE USER_COMMAND_1001 INPUT.
    CASE OK_CODE.
    WHEN 'BACK'.
    CALL SCREEN 0100.
    WHEN 'DISP'.
    PERFORM F_VEND_DISPLAY USING LFA1
    CHANGING SY-DBCNT.
    WHEN 'CHAN'.
    PERFORM F_UPDATE CHANGING LFA1.
    WHEN 'REFR'.
    PERFORM F_REFRESH CHANGING LFA1.
    WHEN 'CREA'.
    PERFORM F_CREATE USING LFA1.
    WHEN 'DELE'.
    PERFORM F_DELETE CHANGING LFA1.
    WHEN 'BNKD'.
    PERFORM F_BANK USING LFA1-LIFNR CHANGING IT_BANK.
    CALL SCREEN 4000.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_1001 INPUT
    *& Module USER_COMMAND_2001 INPUT
    text
    MODULE USER_COMMAND_2001 INPUT.
    CASE OK_CODE.
    WHEN 'BACK'.
    CALL SCREEN '1001'.
    CLEAR LFA1.
    WHEN 'DISP'.
    PERFORM F_GET_BANK USING LFBK
    CHANGING SY-DBCNT.
    WHEN 'CHAN'.
    PERFORM F_UPDATE1 CHANGING LFBK.
    WHEN 'REFR'.
    PERFORM F_REFRESH1 CHANGING LFBK.
    WHEN 'CREA'.
    PERFORM F_CREATE1 USING LFBK.
    WHEN 'DELE'.
    PERFORM F_DELETE1 CHANGING LFBK.
    ENDCASE.
    ENDMODULE. " USER_COMMAND_2001 INPUT
    " USER_COMMAND_4000 INPUT
    *& Include ZB14HAI_MP1_F01
    *& Form F_VEND_DISPLAY
    text
    -->P_LFA1 text
    <--P_DBCNT text
    FORM F_VEND_DISPLAY USING P_LFA1 LIKE LFA1
    CHANGING P_DBCNT LIKE SY-DBCNT.
    SELECT SINGLE * FROM LFA1 WHERE
    LIFNR EQ LFA1-LIFNR.
    IF SY-DBCNT EQ 0.
    MESSAGE E001(ZMSGCLASS).
    ENDIF.
    ENDFORM. " F_VEND_DISPLAY
    *& Form F_GET_BANK
    text
    -->P_LFB1 text
    <--P_SY_DBCNT text
    FORM F_GET_BANK USING P_LFB1 LIKE LFBK
    CHANGING P_SY_DBCNT LIKE SY-DBCNT.
    SELECT SINGLE * FROM LFBK WHERE LIFNR EQ LFBK-LIFNR.
    IF P_SY_DBCNT EQ 0.
    MESSAGE E002(ZMSGCLASS).
    ENDIF.
    ENDFORM. " F_GET_BANK
    *& Form F_UPDATE
    text
    <--P_LFA1 text
    FORM F_UPDATE CHANGING P_LFA1 LIKE LFA1.
    UPDATE LFA1.
    IF SY-SUBRC EQ 0.
    MESSAGE I000(ZHNC) WITH 'RECORDS UPDATED SUCESSFULLY'.
    ENDIF.
    ENDFORM. " F_UPDATE
    *& Form F_REFRESH
    text
    <--P_LFA1 text
    FORM F_REFRESH CHANGING P_LFA1 LIKE LFA1.
    CLEAR LFA1.
    ENDFORM. " F_REFRESH
    *& Form F_CREATE2
    text
    -->P_LFA1 text
    FORM F_CREATE USING P_LFA1 LIKE LFA1.
    INSERT INTO LFA1 VALUES P_LFA1.
    IF SY-SUBRC EQ 0.
    MESSAGE S000(ZHNC) WITH 'VENDOR SUCESSFULLY CREATED'.
    ELSE.
    MESSAGE E000(ZHNC) WITH 'VENDOR ALREADY EXIST'.
    ENDIF.
    ENDFORM. " F_CREATE
    *& Form F_DELETE
    text
    <--P_LFA1 text
    FORM F_DELETE CHANGING P_LFA1 LIKE LFA1.
    DELETE FROM LFA1 WHERE LIFNR EQ LFA1-LIFNR.
    IF SY-SUBRC EQ 0 .
    MESSAGE S000(ZHNC) WITH 'RECORD SUCESSFULLY DELETED'.
    ENDIF.
    ENDFORM. " F_DELETE
    *& Form F_UPDATE1
    text
    <--P_LFA1 text
    FORM F_UPDATE1 CHANGING P_LFBK LIKE LFBK.
    UPDATE LFBK.
    IF SY-SUBRC EQ 0.
    MESSAGE I000(ZHNC) WITH 'RECORDS UPDATED SUCESSFULLY'.
    ENDIF.
    ENDFORM. " F_UPDATE1
    *& Form F_REFRESH1
    text
    <--P_LFA1 text
    FORM F_REFRESH1 CHANGING P_LFBK LIKE LFBK.
    CLEAR LFBK.
    ENDFORM. " F_REFRESH1
    *& Form F_CREATE1
    text
    -->P_LFA1 text
    FORM F_CREATE1 USING P_LFBK LIKE LFBK.
    INSERT INTO LFBK VALUES P_LFBK.
    IF SY-SUBRC EQ 0.
    MESSAGE S000(ZHNC) WITH 'VENDOR SUCESSFULLY CREATED'.
    ELSE.
    MESSAGE E000(ZHNC) WITH 'VENDOR ALREADY EXIST'.
    ENDIF.
    ENDFORM. " F_CREATE1
    *& Form F_DELETE1
    text
    <--P_LFA1 text
    FORM F_DELETE1 CHANGING P_LFBK LIKE LFBK.
    ENDFORM. " F2_DELETE1
    *& Form F_BANK
    text
    -->P_LFA1_LIFNR text
    <--P_IT_BANK text
    FORM F_BANK USING P_LFA1_LIFNR LIKE LFA1-LIFNR
    CHANGING P_IT_BANK LIKE IT_BANK.
    SELECT * FROM LFBK INTO CORRESPONDING FIELDS OF TABLE IT_BANK
    WHERE LIFNR EQ P_LFA1_LIFNR.
    ENDFORM. " F_BANK
    full points to be awarded

    hi ,
    try this code
    *& Module pool       SAPMZ50818_MODUL_TABLECNTRL                       *
    PROGRAM TITLE      : SALES ORDER LINE ITEM DESPLAY                  *
    AREA               : SD                                             *
    AUTHOR             : Fareeda .s                                     *
    CREATED ON         : 24/10/2007                                     *
    OBJECT TYPE        : MODULE POOL                                    *
    DESCRIPTION        :  The objective of this module pool is to display*
                          the list of sales orders within a given range  *
                          of customers entered on the selection screen.  *
                       Modification Log                                 *
    Author                : FAREEDA                                    *
    Date of Change        : 25/10/07                                   *
    Functional Specs #    :                                            *
    Correction Request #  :                                            *
    Description of Change : PF_STATUS                                  *
    PROGRAM  SAPMZ50818_MODUL_TABLECNTRL MESSAGE-ID ZFAR.
    TABLES KNA1.
    First internal table for screen 200
    DATA: BEGIN OF IT_TAB OCCURS 0,
          CHK,
          VBELN   TYPE VBAK-VBELN,
          KUNNR   TYPE VBAK-KUNNR,
          ERNAM   TYPE VBAK-ERNAM,
          AUDAT   TYPE VBAK-AUDAT,
          VBTYP   TYPE VBAK-VBTYP,
          END OF IT_TAB.
    Second internal table for screen 300
    DATA: BEGIN OF IT_TAB1 OCCURS 0,
          VBELN    TYPE VBAP-VBELN,
          POSNR    TYPE VBAP-POSNR,
          PSTYV    TYPE VBAP-PSTYV,
          POSAR    TYPE VBAP-POSAR,
          END OF IT_TAB1.
    ok_code declaration
    DATA  OK_CODE TYPE SY-UCOMM.
    DATA: V_Kna1 LIKE KNA1.
    *&      Module  STATUS_0100  OUTPUT
    PF-STATUS FOR SCREEN 0100
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'FAR'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE USER_COMMAND_0100 INPUT.
      OK_CODE = SY-UCOMM.
      CASE OK_CODE.
        WHEN 'DISP' OR SPACE.
          SELECT SINGLE *
            FROM KNA1
            INTO KNA1
           WHERE KUNNR = KNA1-KUNNR.
          SELECT *
            FROM VBAK
           INTO  CORRESPONDING FIELDS OF TABLE IT_TAB
           WHERE KUNNR = KNA1-KUNNR.
          IF SY-SUBRC <> 0.
            MESSAGE 'NO RECORDS FOUND' TYPE 'E'.
          ENDIF.
        WHEN 'BACK'.
          LEAVE PROGRAM.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Module  USER_COMMAND_0200  INPUT
    MODULE USER_COMMAND_0200 INPUT.
      CONTROLS TC1 TYPE TABLEVIEW USING SCREEN 200.
      SET PF-STATUS 'ZFAR'.
      CASE OK_CODE.
        WHEN 'BACK'.
          LEAVE TO SCREEN 100.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
        WHEN 'DISP'.
          CLEAR IT_TAB.
          READ TABLE IT_TAB WITH KEY CHK = 'X'.
          IF NOT IT_TAB-CHK IS INITIAL.
            SELECT VBELN POSNR PSTYV POSAR
              FROM VBAP
              INTO TABLE IT_TAB1
             WHERE VBELN = IT_TAB-VBELN.
    *------Processing error
            IF SY-SUBRC <> 0.
              MESSAGE 'NO ITEMS FOUND' TYPE 'E'.
            ENDIF.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0200  INPUT
    *&      Module  STATUS_0200  OUTPUT
    PF-STATUS FOR SCREEN 0200
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'ZFAR'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    **&      Module  STATUS_0300  OUTPUT
    PF-STATUS FOR SCREEN 0300
    *MODULE STATUS_0300 OUTPUT.
    SET PF-STATUS 'FAR2'.
    SET TITLEBAR 'TITLE'.
    *ENDMODULE.                 " STATUS_0300  OUTPUT
    *&      Module  MODIFY  INPUT
    modifying  table input
    MODULE MODIFY INPUT.
      MODIFY IT_TAB INDEX TC1-CURRENT_LINE.
    ENDMODULE.                 " MODIFY  INPUT
    *&      Module  USER_COMMAND_0300  INPUT
    table control for third screen
    MODULE USER_COMMAND_0300 INPUT.
      CONTROLS TC2 TYPE TABLEVIEW USING SCREEN 300.
      SET PF-STATUS 'FAR2'.
    *------case
      CASE OK_CODE.
    leave to previous screen.
      WHEN 'DISP'.
          LEAVE TO SCREEN 200.
        WHEN 'EXIT'.
          LEAVE PROGRAM.
    error record no existing sales item found
          IF SY-SUBRC <> 0.
            MESSAGE 'NO SA_ITEMS FOUND' TYPE 'E'.
          ENDIF.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0300  INPUT
    *&      Module  VALIDATE_KUNNR  INPUT
    validating kunnr
    MODULE VALIDATE_KUNNR INPUT.
      V_KNA1 = KNA1.
      SELECT SINGLE *
              FROM KNA1
              INTO KNA1
             WHERE KUNNR = KNA1-KUNNR.
    *------Process information
      IF SY-SUBRC <> 0.
        CLEAR KNA1.
        KNA1-KUNNR = V_KNA1-KUNNR.
        CASE OK_CODE.
    leave program
          WHEN 'BACK'.
            LEAVE PROGRAM.
        ENDCASE.
    raises an error that no customers found.
        MESSAGE 'NO CUSTOMER FOUND' type 'E'.
        LEAVE TO SCREEN 100.
      ENDIF.
    ENDMODULE.                 " VALIDATE_KUNNR  INPUT

  • Plz help me with this error

    hello plz help me wat i can do for this error and plz also tell me where to place the POI api in tomcat directory.........
    The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: Unable to compile class for JSP
    An error occurred at line: 22 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    [javac] Compiling 1 source file
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:13: ';' expected
    import org.a
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:8: package org.apache.poi.poifs.filesystem does not exist
    import org.apache.poi.poifs.filesystem.POIFSFileSystem;
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:9: package org.apache.poi.hssf.record does not exist
    import org.apache.poi
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:11: package org.apache.poi.hssf.model does not exist
    import org.apache.poi.hssf.model.*;
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:12: package org.apache.poi.hssf.usermodel does not exist
    import org.apache.poi.hssf.usermodel.*;
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:13: cannot resolve symbol
    symbol : class a
    location: package org
    import org.a
    ^
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:74: cannot resolve symbol
    symbol : class POIFSFileSystem
    location: class org.apache.jsp.HSSFExample_jsp
    POIFSFileSystem fs =
    ^
    An error occurred at line: 22 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:75: cannot resolve symbol
    symbol : class POIFSFileSystem
    location: class org.apache.jsp.HSSFExample_jsp
    new POIFSFileSystem(new FileInputStream(filename));
    ^
    An error occurred at line: 22 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:76: cannot resolve symbol
    symbol : class HSSFWorkbook
    location: class org.apache.jsp.HSSFExample_jsp
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    ^
    An error occurred at line: 22 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:76: cannot resolve symbol
    symbol : class HSSFWorkbook
    location: class org.apache.jsp.HSSFExample_jsp
    HSSFWorkbook wb = new HSSFWorkbook(fs);
    ^
    An error occurred at line: 35 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:89: cannot resolve symbol
    symbol : class HSSFSheet
    location: class org.apache.jsp.HSSFExample_jsp
    HSSFSheet sheet = wb.getSheetAt(k);
    ^
    An error occurred at line: 35 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:94: cannot resolve symbol
    symbol : class HSSFRow
    location: class org.apache.jsp.HSSFExample_jsp
    HSSFRow row = sheet.getRow(r);
    ^
    An error occurred at line: 48 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:108: cannot resolve symbol
    symbol : class HSSFCell
    location: class org.apache.jsp.HSSFExample_jsp
    HSSFCell cell = row.getCell(c);
    ^
    An error occurred at line: 48 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:115: cannot resolve symbol
    symbol : variable HSSFCell
    location: class org.apache.jsp.HSSFExample_jsp
    case HSSFCell.CELL_TYPE_FORMULA :
    ^
    An error occurred at line: 48 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:119: cannot resolve symbol
    symbol : variable HSSFCell
    location: class org.apache.jsp.HSSFExample_jsp
    case HSSFCell.CELL_TYPE_NUMERIC :
    ^
    An error occurred at line: 48 in the jsp file: /HSSFExample.jsp
    Generated servlet error:
    C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\examples\HSSFExample_jsp.java:125: cannot resolve symbol
    symbol : variable HSSFCell
    location: class org.apache.jsp.HSSFExample_jsp
    case HSSFCell.CELL_TYPE_STRING :
    ^
    16 errors
         at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
         at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248)
         at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:315)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:328)
         at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
         at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
         at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
         at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:809)
         at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:200)
         at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:146)
         at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:209)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:144)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:445)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2358)
         at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:118)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:116)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
         at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
         at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
         at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:948)
         at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:152)
         at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
         at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
         at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
         at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
         at java.lang.Thread.run(Thread.java:536)

    You can put the POI jar file in the WEB-INF/lib directory of your application, or if you want to use it in multiple applications you can put it in the tomcat 4.1/shared/lib directory.

  • PLZ PLZ PLZ help me with this **bleep**er E65

    the themes that i installed does not show up in uninstaller then i cant uninstal them .i removed them by formating memory card now i cant install those themes again and i want them realy .i think they didnt remove from some where in my phon memory then that wont let me to install them again help me plz and tell what should i do (
    Tnx for any help and cheer

    u should hard reset ur phone using this code *#7370#
    NOTE : THIS CODE DELETE ALL DATA ON UR PHONE
    it will be like a new one after appling this code
    note : S60 3rd phones does not support many themes = u cant install many themes on ur mobile ( i think only 10 )
    T18>6210>8310>6800>6210>7610>6680>6210>E50>3110>2610>E65>E61i

  • Can some one help me with this date stuff

    Hello,
    I wat to write a method that will take a date or a month and then return the time period
    b4 that date or month..criteria would be like this..
    if the pweriod is weekly then the enddate will be passed and it should return date that was 7 days
    prior to the enddate. For e.g
    enddate = 3 April 2002
    the method should return
    begindate = 27 March 2002
    here is the method I am trying to work with...
    what I am doing do far is a break down the date into integer values and then reconstruct the date again
    ...I am not being successful doing so..please take a look at my code and tell me what am I doing wrong
    thanks
    public static Date getBiginingOfPeriodDate(Date endDate){
    Date beginDate = null;
    Calendar calendar = Calendar.getInstance();
    System.out.println("Date passed = "+endDate);
    calendar.setTime(endDate);
    int iDay = calendar.get(Calendar.DAY_OF_MONTH);
    int iMon = calendar.get(Calendar.MONTH);
    int iYr = calendar.get(Calendar.YEAR);
    System.out.println("End date int values [ "+iDay+", "+iMon+", "+iYr);
    calendar.set(iDay,iMon,iYr);
    System.out.println("create end date from in values [ "+calendar.getTime()+" ]");
    return beginDate;
    }

    If all you want to do is simple date arithmetic, such as subtracting 7 days from a date, just use the java.util.Calendar class, which provides methods (such as add) to do that for you. Don't "reinvent the wheel".

  • Can somebody please help me with this? Security code issue; very small code

    Hi All, Iam a Unix admin and trying to learn Java/weblogic. I have a JSP and iam trying to run on my weblogic 81 Service Pack version 3.
    My following code failed to work and giving me some security exceptions. Then in my weblogic console i saw
    Domain Wide Security Settings > Anonymous Admin Lookup Enabled
    The above checkbox is disabled. When i enabled, it worked. I talked to my company "Security" folks and they do not allow this checkbox to be enabled. they are saying fix your code problem......
    if somebody can please let me know what a probable fix would, that be great and very helpful.
    try{
    Environment env = new Environment();   
    javax.naming.InitialContext ic = new InitialContext();
    MBeanHome home = (MBeanHome) ic.lookup(MBeanHome.LOCAL_JNDI_NAME);
    DomainMBean dom = home.getActiveDomain();
    Set s = home.getMBeansByType("ServerRuntime");
    ServerRuntimeMBean srmb = (ServerRuntimeMBean) s.iterator().next();
    WebLogicObjectName on = new WebLogicObjectName(home.getDomainName()+":Location="+srmb.getName()+",Name="+srmb.getName()+",Type=ServerConfig");
    //WebLogicObjectName on = new WebLogicObjectName(Name="+srmb.getName()+",Type="ServerConfig",Domain="+home.getDomainName()+",Location="+srmb.getName()+");
    ServerMBean server = (ServerMBean) home.getMBean(on);
    ClusterMBean cluster = null;
    if( server != null)
        cluster = server.getCluster();

    did i asked such a dumb question? ... :)Well, yes, sort of. The problem description "My following code failed to work and giving me some security exceptions" doesn't have nearly enough details. Such as, what exceptions, what is it supposed to do, what did it do instead, that sort of thing.

  • Plz help me with this query

    i need to get each manager name, his department name and for each year that is for 81,82,83,84 count of employee's under that manager from emp and dept tables .
    thanks in advance
    select distinct deptno, TO_CHAR (HIREDATE, 'YY'), count(*) from emp group by TO_CHAR(HIREDATE, 'YY'), DEPTNO ORDER BY TO_CHAR(HIREDATE, 'YY'), DEPTNO;
    the above query returns me count of employees ,year and deptno
    SELECT DISTINCT E2.ENAME , E1.ENAME, E1.DEPTNO, E1.MGR, E1.EMPNO, E1.SAL, D.DNAME, D.LOC FROM EMP E1, EMP E2, DEPT D WHERE E1.MGR = E2.EMPNO AND E1.DEPTNO = D.DEPTNO ORDER BY E1.DEPTNO;
    this query returned me manager names and employees under them
    Message was edited by:
    user450660

    At that point you're not too far off, you have most of what you need. In general, any time you see the use of DISTINCT it's a sign that either your query or your data model isn't designed quite right.
    SELECT m.ename,
           d.dname,
           TO_CHAR (e.hiredate, 'YY') AS hire_year,
           COUNT(*) AS emp_count
      FROM emp e, emp m, dept d
    WHERE e.mgr = m.empno
       AND m.deptno = d.deptno
    GROUP BY
           m.ename,
           d.dname,
           TO_CHAR (e.hiredate, 'YY');

  • Plz help me with this

    hi..
    i have the value for POSITION (PLANS)....
    using 'plans'....i need to get its 'werks', 'persg', 'persk'....
    from which table can i get these?
    regards
    balaji.

    Hi Balaji,
    This is how it always work
    SELECT SINGLE sobid FROM hrp1001 INTO manager WHERE otype = 'S'        AND
                                                              objid = l1_pos     AND
                                                              plvar = '01'       AND
                                                              rsign = 'A'        AND                                                          relat = '008'      AND
                                                              istat = '1'        AND
                                                              begda <= sy-datum  AND
                                                              endda >= sy-datum  AND
                                                              sclas = 'P'.
    then call
       CALL FUNCTION 'HR_READ_INFOTYPE'
          EXPORTING
            pernr           = manager
            infty           = '0001'
          TABLES
            infty_tab       = it_0001
          EXCEPTIONS
            infty_not_found = 1
            OTHERS          = 2.
    and then read it_0001 to get each of these fields you are looking for.
    Warm Regards,
    Sudhir

  • Plz help me with this problem

    SQL> SET SERVEROUTPUT ON
    SQL> VARIABLE g_name VARCHAR2
    SQL> VARIABLE g_mngr NUMBER
    SQL> VARIABLE g_depid VARCHAR2
    SQL> VARIABLE g_proid number
    SQL> VARIABLE g_proname varchar2
    SQL> CREATE OR REPLACE PROCEDURE mngr_info
    2 ( p_id IN employees.emp_id%type,
    3 p_name OUT employees.last_name%type,
    4 p_mngr OUT employees.mngr_id%type,
    5 p_depid OUT employees.dep_id%type,
    6 p_proid OUT projects.pro_id%type,
    7 p_proname OUT projects.pro_name%type)
    8 IS
    9 BEGIN
    10 SELECT e.mngr_id,e.last_name,e.dep_id,p.pro_id,p.pro_name
    11 INTO p_mngr,p_name,p_depid,p_proid,p_proname
    12 FROM employees e, projects p
    13 WHERE e.mngr_id=p.mngr_id
    14 AND e.emp_id=p_id;
    15 EXCEPTION
    16 WHEN NO_DATA_FOUND THEN
    17 DBMS_OUTPUT.PUT_LINE('emp id does not exist');
    18 commit;
    19 END mngr_info;
    20
    21 /
    Procedure created.
    SQL> EXECUTE mngr_info(3,:g_mngr,:g_name,:g_depid,:g_proid,:g_proname);
    BEGIN mngr_info(3,:g_mngr,:g_name,:g_depid,:g_proid,:g_proname); END;
    ERROR at line 1:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SCOTT.MNGR_INFO", line 10
    ORA-06512: at line 1

    Hi,
    mngr_info(3,:g_mngr,:g_name,:g_depid,:g_proid,:g_proname);
    Check the parameters list and the out parameters what you have declared.
    ,:g_mngr is first column (number )you are returning from the SP and then
    p_name which are of irregular type (varchar).
    Can varchar we handled in number.??
    that is the Issue.
    Thanks & Regards,
    Pavan Kumar N

  • Can someone pls help me with this code

    The method createScreen() creates the first screen wherein the user makes a selection if he wants all the data ,in a range or single data.The problem comes in when the user makes a selection of single.that then displays the singleScreen() method.Then the user has to input a key data like date or invoice no on the basis of which all the information for that set of data is selected.Now if the user inputs a wrong key that does not exist for the first time the program says invalid entry of data,after u click ok on the option pane it prompts him to enter the data again.But since then whenever the user inputs wrong data the program says wrong data but after displaying the singlescreen again does not wait for input from the user it again flashes the option pane with the invalid entry message.and this goes on doubling everytime the user inputs wrong data.the second wrong entry of data flashes the error message twice,the third wrong entry flashes the option pane message 4 times and so on.What actually happens is it does not wait at the singlescreen() for user to input data ,it straight goes into displaying the JOptionPane message for wrong data entry so we have to click the optiion pane twice,four times and so on.
    Can someone pls help me with this!!!!!!!!!
    import java.util.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.text.*;
    import java.util.*;
    public class MainMenu extends JFrame implements ActionListener,ItemListener{
    //class     
         FileReaderDemo1 fd=new FileReaderDemo1();
         FileReaderDemo1 fr;
         Swing1Win sw;
    //primary
         int monthkey=1,counter=0;
         boolean flag=false,splitflag=false;
         String selection,monthselection,dateselection="01",yearselection="00",s,searchcriteria="By Date",datekey,smonthkey,invoiceno;
    //arrays
         String singlesearcharray[];
         String[] monthlist={"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sept","Oct","Nov","Dec"};
         String[] datelist=new String[31];
         String[] yearlist=new String[100];
         String[] searchlist={"By Date","By Invoiceno"};
    //collection
         Hashtable allinvoicesdata=new Hashtable();
         Vector data=new Vector();
         Enumeration keydata;
    //components
         JButton next=new JButton("NEXT>>");
         JComboBox month,date,year,search;
         JLabel bydate,byinvno,trial;
         JTextField yeartext,invtext;
         JPanel panel1,panel2,panel3,panel4;
         JRadioButton single,range,all;
         ButtonGroup group;
         JButton select=new JButton("SELECT");
    //frame and layout declarations
         JFrame jf;
         Container con;
         GridBagLayout gridbag=new GridBagLayout();
         GridBagConstraints gc=new GridBagConstraints();
    //constructor
         MainMenu(){
              jf=new JFrame();
              con=getContentPane();
              con.setLayout(null);
              fr=new FileReaderDemo1();
              createScreen();
              setSize(500,250);
              setLocation(250,250);
              setVisible(true);
    //This is thefirst screen displayed
         public void createScreen(){
              group=new ButtonGroup();
              single=new JRadioButton("SINGLE");
              range=new JRadioButton("RANGE");
              all=new JRadioButton("ALL");
              search=new JComboBox(searchlist);
              group.add(single);
              group.add(range);
              group.add(all);
              single.setBounds(100,50,100,20);
              search.setBounds(200,50,100,20);
              range.setBounds(100,90,100,20);
              all.setBounds(100,130,100,20);
              select.setBounds(200,200,100,20);
              con.add(single);
              con.add(search);
              con.add(range);
              con.add(all);
              con.add(select);
              search.setEnabled(false);
              single.addItemListener(this);
              search.addActionListener(new MyActionListener());     
              range.addItemListener(this);
              all.addItemListener(this);
              select.addActionListener(this);
         public class MyActionListener implements ActionListener{
              public void actionPerformed(ActionEvent a){
                   JComboBox cb=(JComboBox)a.getSource();
                   if(a.getSource().equals(month))
                        monthkey=((cb.getSelectedIndex())+1);
                   if(a.getSource().equals(date)){
                        dateselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(year))
                        yearselection=(String)cb.getSelectedItem();
                   if(a.getSource().equals(search)){
                        searchcriteria=(String)cb.getSelectedItem();
         public void itemStateChanged(ItemEvent ie){
              if(ie.getItem()==single){
                   selection="single";     
                   search.setEnabled(true);
              else if (ie.getItem()==all){
                   selection="all";
                   search.setEnabled(false);
              else if (ie.getItem()==range){
                   search.setEnabled(false);
         public void actionPerformed(ActionEvent ae){          
              if(ae.getSource().equals(select))
                        if(selection.equals("single")){
                             singleScreen();
                        if(selection.equals("all"))
                             sw=new Swing1Win();
              if(ae.getSource().equals(next)){
                   if(monthkey<9)
                        smonthkey="0"+monthkey;
                   System.out.println(smonthkey+"/"+dateselection+"/"+yearselection+"it prints this");
                   allinvoicesdata=fr.read(searchcriteria);
                   if (searchcriteria.equals("By Date")){
                        System.out.println("it goes in this");
                        singleinvoice(smonthkey+"/"+dateselection+"/"+yearselection);
                   else if (searchcriteria.equals("By Invoiceno")){
                        invoiceno=invtext.getText();
                        singleinvoice(invoiceno);
                   if (flag == false){
                        System.out.println("flag is false");
                        singleScreen();
                   else{
                   System.out.println("its in here");
                   singlesearcharray=new String[data.size()];
                   data.copyInto(singlesearcharray);
                   sw=new Swing1Win(singlesearcharray);
         public void singleinvoice(String searchdata){
              keydata=allinvoicesdata.keys();
              while(keydata.hasMoreElements()){
                        s=(String)keydata.nextElement();
                        if(s.equals(searchdata)){
                             System.out.println(s);
                             flag=true;
                             break;
              if (flag==true){
                   System.out.println("vector found");
                   System.exit(0);
                   data= ((Vector)(allinvoicesdata.get(s)));
              else{
                   JOptionPane.showMessageDialog(jf,"Invalid entry of date : choose again");     
         public void singleScreen(){
              System.out.println("its at the start");
              con.removeAll();
              SwingUtilities.updateComponentTreeUI(con);
              con.setLayout(null);
              counter=0;
              panel2=new JPanel(gridbag);
              bydate=new JLabel("By Date : ");
              byinvno=new JLabel("By Invoice No : ");
              dateComboBox();
              invtext=new JTextField(6);
              gc.gridx=0;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(month,gc);
              panel2.add(month);
              gc.gridx=1;
              gc.gridy=0;
              gridbag.setConstraints(date,gc);
              panel2.add(date);
              gc.gridx=2;
              gc.gridy=0;
              gc.gridwidth=1;
              gridbag.setConstraints(year,gc);
              panel2.add(year);
              bydate.setBounds(100,30,60,20);
              con.add(bydate);
              panel2.setBounds(170,30,200,30);
              con.add(panel2);
              byinvno.setBounds(100,70,100,20);
              invtext.setBounds(200,70,50,20);
              con.add(byinvno);
              con.add(invtext);
              next.setBounds(300,200,100,20);
              con.add(next);
              if (searchcriteria.equals("By Invoiceno")){
                   month.setEnabled(false);
                   date.setEnabled(false);
                   year.setEnabled(false);
              else if(searchcriteria.equals("By Date")){
                   byinvno.setEnabled(false);
                   invtext.setEnabled(false);
              monthkey=1;
              dateselection="01";
              yearselection="00";
              month.addActionListener(new MyActionListener());
              date.addActionListener(new MyActionListener());
              year.addActionListener(new MyActionListener());
              next.addActionListener(this);
              invtext.addKeyListener(new KeyAdapter(){
                   public void keyTyped(KeyEvent ke){
                        char c=ke.getKeyChar();
                        if ((c == KeyEvent.VK_BACK_SPACE) ||(c == KeyEvent.VK_DELETE)){
                             System.out.println(counter+"before");
                             counter--;               
                             System.out.println(counter+"after");
                        else
                             counter++;
                        if(counter>6){
                             System.out.println(counter);
                             counter--;
                             ke.consume();
                        else                    
                        if(!((Character.isDigit(c) || (c == KeyEvent.VK_BACK_SPACE) || (c == KeyEvent.VK_DELETE)))){
                             getToolkit().beep();
                             counter--;     
                             JOptionPane.showMessageDialog(null,"please enter numerical value");
                             ke.consume();
              System.out.println("its at the end");
         public void dateComboBox(){          
              for (int counter=0,day=01;day<=31;counter++,day++)
                   if(day<=9)
                        datelist[counter]="0"+String.valueOf(day);
                   else
                        datelist[counter]=String.valueOf(day);
              for(int counter=0,yr=00;yr<=99;yr++,counter++)
                   if(yr<=9)
                        yearlist[counter]="0"+String.valueOf(yr);
                   else
                        yearlist[counter]=String.valueOf(yr);
              month=new JComboBox(monthlist);
              date=new JComboBox(datelist);
              year=new JComboBox(yearlist);
         public static void main(String[] args){
              MainMenu mm=new MainMenu();
         public class WindowHandler extends WindowAdapter{
              public void windowClosing(WindowEvent we){
                   jf.dispose();
                   System.exit(0);
    }     

    Hi,
    I had a similar problem with a message dialog. Don't know if it is a bug, I was in a hurry and had no time to search the bug database... I found a solution by using keyPressed() and keyReleased() instead of keyTyped():
       private boolean pressed = false;
       public void keyPressed(KeyEvent e) {
          pressed = true;
       public void keyReleased(KeyEvent e) {
          if (!pressed) {
             e.consume();
             return;
          // Here you can test whatever key you want
       //...I don't know if it will help you, but it worked for me.
    Regards.

  • Can somebody help me with this code?

    Can anyone help me with this code? My problem is that i can't
    seem to position this form, i want to be able to center it
    vertically & horizontally in a div either using CSS or any
    other means.
    <div id="searchbar"><!--Search Bar -->
    <div id="searchcart">
    <div class="serchcartcont">
    <form action='
    http://www.romancart.com/search.asp'
    name="engine" target=searchwin id="engine">
    <input type=hidden value=????? name=storeid>
    <input type=text value='' name=searchterm>
    <input type=submit value='Go'> </form>
    </div>
    </div>
    <div class="searchcont">Search For
    Products:</div>
    </div><!-- End Search Bar -->
    Pleasssssseeeeeeee Help
    Thanks

    Hi,
    Your form is defined in a div named "serchcartcont", you can
    use attributes like position and align of the div to do what you
    want to do. But there are two more dives above this dive, you will
    have define the height width of these before you can center align
    the inner most div. If you are not defining the height & width
    then by default it decide it automatically to just fit the content
    in it.
    Hope this helps.
    Maneet
    LeXolution IT Services
    Web Development
    Company

  • Unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    unable to update itunes. help. error message when trying to update to latest version of itunes. "the installer has encountered an unexpected error installing this package. this may indicate a problem with this package. error code 2721"

    Hello chae84swangin,
    I recommend following the steps in the article below when getting an error message trying to install iTunes:
    Trouble installing iTunes or QuickTime for Windows
    http://support.apple.com/kb/HT1926
    Thank you for using Apple Support Communities.
    Best,
    Sheila M.

  • Please! help me with this wrong code, where is mistake

    please! help me with this wrong code, where is mistake?
    import java.util.Stack;
    public class KnightsTour {
    Vars locs[];
    private int size, max=1, d=0, board[][];
    public KnightsTour(int x,int y, int newSize)
         size=newSize;
         locs=new Vars[size*size+1];
         for(int n=1;n<=size*size;n++)
              locs[n]=new Vars();
         board=new int[size+1][size+1];
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   board[n][n2]=0;
         locs[max].x=x;
         locs[max].y=y;
         locs[max].d=1;
         board[x][y]=max;
         max++;
    class Vars{
         int x;
         int y;
         int d;
    public void GO()
         int n=0;
         while(max<=size*size)
              n++;
              d++;
              if(d>8)
                   max--;
                   board[locs[max].x][locs[max].y]=0;
                   d=locs[max].d+1;
              move();
         printBoard();
    public void move()
         int x=locs[max-1].x, y=locs[max-1].y;
         switch(d)
         case 1:x--;y-=2;break;
         case 2:x++;y-=2;break;
         case 3:x+=2;y--;break;
         case 4:x+=2;y++;break;
         case 5:x++;y+=2;break;
         case 6:x--;y+=2;break;
         case 7:x-=2;y++;break;
         case 8:x-=2;y--;break;
         //System.out.println(" X: "+x+" Y: "+y+" |"+max);
         if((x<1)||(x>size)||(y<1)||(y>size)){}
         else if(board[x][y]!=0){}
         else
              locs[max].x=x;
              locs[max].y=y;
              locs[max].d=d;
              board[x][y]=max;
              max++;
              d=0;
              //printBoard();
    public void printBoard()
         for(int n=1;n<=size;n++)
              for(int n2=1;n2<=size;n2++)
                   if(board[n2][n]<10)
                        System.out.print(board[n2][n]+" ");
                   else
                        System.out.print(board[n2][n]+" ");
              System.out.println();
         //System.out.println();
         System.out.println();
         public static void main (String[]args){
              KnightsTour k = new KnightsTour(1,1,8);
         }

    public class KnightsTour {
        Vars locs[];
        private int size,  max = 1,  d = 0,  board[][];
        public static void main (String[] args) {
            KnightsTour k = new KnightsTour (1, 1, 8);
            k.GO ();
        public KnightsTour (int x, int y, int newSize) {
            size = newSize;
            locs = new Vars[size * size + 1];
            for (int n = 1; n <= size * size; n++) {
                locs[n] = new Vars ();
            board = new int[size + 1][size + 1];
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    board[n][n2] = 0;
            locs[max].x = x;
            locs[max].y = y;
            locs[max].d = 1;
            board[x][y] = max;
            max++;
        class Vars {
            int x;
            int y;
            int d;
        public void GO () {
            int n = 0;
            while (max <= size * size) {
                n++;
                d++;
                if (d > 8) {
                    max--;
                    board[locs[max].x][locs[max].y] = 0;
                    d = locs[max].d + 1;
                move ();
            printBoard ();
        public void move () {
            int x = locs[max - 1].x, y = locs[max - 1].y;
            switch (d) {
                case 1:
                    x--;
                    y -= 2;
                    break;
                case 2:
                    x++;
                    y -= 2;
                    break;
                case 3:
                    x += 2;
                    y--;
                    break;
                case 4:
                    x += 2;
                    y++;
                    break;
                case 5:
                    x++;
                    y += 2;
                    break;
                case 6:
                    x--;
                    y += 2;
                    break;
                case 7:
                    x -= 2;
                    y++;
                    break;
                case 8:
                    x -= 2;
                    y--;
                    break;
    //System.out.println(" X: "x" Y: "y" |"+max);
            if ((x < 1) || (x > size) || (y < 1) || (y > size)) {
            } else if (board[x][y] != 0) {
            } else {
                locs[max].x = x;
                locs[max].y = y;
                locs[max].d = d;
                board[x][y] = max;
                max++;
                d = 0;
    //printBoard();
        public void printBoard () {
            for (int n = 1; n <= size; n++) {
                for (int n2 = 1; n2 <= size; n2++) {
                    if (board[n2][n] < 10) {
                        System.out.print (board[n2][n] + " ");
                    } else {
                        System.out.print (board[n2][n] + " ");
                System.out.println ();
    //System.out.println();
            System.out.println ();
    }formatting ftw.
    If you call GO () you get in an infinite loop. max gets decreased, and it loops while max is smaller then or equal to size * size. Is your looping logic correct ?

  • I can't download iOS 7 on my iPad 3. I says my software is up to date (6.1.3). Can anyone help me with this?

    I can't download iOS 7 on my iPad 3. I says my software is up to date (6.1.3). Can anyone help me with this?

    May just be the update server acting glitchy due all the people slamming it right now. I'd give it 24 hrs, and if it's still doing it, check back in here and we'll see if we can't figure it out.
    = L.I.

  • I brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    i brought a iTunes card and the the code on the back is not there it has faded away can u please help me with this problem

    Hi Daniel ...
    Try here > iTunes Store: Invalid, inactive, or illegible codes

Maybe you are looking for

  • How to handle the quotes('') in the procedure?

    Hi all, I have been struggling with an issue in the procedure. Let us go to the functionality of the preocedure. I am passing a parameter that has text like ' INDIA,BANGALORE,"INOX,BLR","THILAK NAGAR,JAYA NAGAR "4TH 'T' BLOCK,BANGALORE",560030' Here,

  • Mass PO Change By LSMW

    Hi Gurus, I want the LSMW procedure to mass change the PO. Suppose to change the multiple line items or Price of each line item. Plz suggest. Thanks & Regards Akshay

  • Authorization check - customer exit EXIT_SAPLRRS0_001

    Hi gurus, a question on customer exit about EXIT_SAPLRRS0_001 related to i_step = 0 (Authorization check). I have two InfoObjects: 0WS_CAT and 0WSCATQ. The last one has a compounding that is 0WS_CAT. In the exit: I need to check the 0WS_OBSFLAG (a si

  • Read product categories under extended attributes tab in org structure.

    Hi SRM gurus, We have a requirement to read all product categories maintained for purchaser under Extended Attributes tab in Organizational Structure. Can anyone let me know any FM, BAPI available to read the product categories listed in organization

  • Restore from time machine running snow leopard

    I just had my Seagate HD replaced due to a recall.  Got my iMac back with the OS installed from apple and a clean machine.  Trying to restore to my previous state through TM but it won't allow me to access the recovery promt upon startup. (Command+R)