Unable to resolve 'class' or 'interface' expected compile error

Any help would be appreciated - I can't resolve the following compile errors:
E:\j2sdk1.4.0\bin\RandomApp3\src\RandomApp3.java:85: 'class' or 'interface' expected private void initComponents() {
E:\j2sdk1.4.0\bin\RandomApp3\src\RandomApp3.java:97: 'class' or 'interface' expected }
E:\j2sdk1.4.0\bin\RandomApp3\src\RandomApp3.java:97: 'class' or 'interface' expected }
3 errors
here is the source:
import javax.swing.JOptionPane;
import java.applet.Applet;
import java.awt.Graphics;
import java.util.Random;
public class RandomApp3 extends javax.swing.JApplet {
public RandomApp3() {
public static void main(String args[]) {
/** Creates a new instance of RandomApp3 */
public class RandInt {
private Random randNum;
//constructor for RandInt class
public RandInt(int endInt) {
int randNum;
int range;
int[] lottery = new int[5];
for (int x = 0; x <=49; x++) {
range = (int) (Math.floor(Math.random()*5 + 1));
lottery[range]++;
/** Initializes the applet RandomApp3 */
public void initComponents() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
} catch (Exception ex) {
ex.printStackTrace();
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
panell = new java.awt.Panel();
getContentPane().add(panell, java.awt.BorderLayout.CENTER);
// </editor-fold>
// Variables declaration - do not modify
private java.awt.Panel panel1;
// End of variables declaration
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
panel1 = new java.awt.Panel();
getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
// </editor-fold>
// Variables declaration - do not modify
private java.awt.Panel panel1;
// End of variables declaration
}

Re-posted with code tags. This may show that there is an extra } just before initComponents()
public class RandomApp3 extends javax.swing.JApplet {
public RandomApp3() {
public static void main(String args[]) {
/** Creates a new instance of RandomApp3 */
public class RandInt {
private Random randNum;
//constructor for RandInt class
public RandInt(int endInt) {
int randNum;
int range;
int[] lottery = new int[5];
for (int x = 0; x <=49; x++) {
range = (int) (Math.floor(Math.random()*5 + 1));
lottery[range]++;
/** Initializes the applet RandomApp3 */
public void initComponents() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
initComponents();
} catch (Exception ex) {
ex.printStackTrace();
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
panell = new java.awt.Panel();
getContentPane().add(panell, java.awt.BorderLayout.CENTER);
// </editor-fold>
// Variables declaration - do not modify
private java.awt.Panel panel1;
// End of variables declaration
/** This method is called from within the init() method to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc=" Generated Code ">
private void initComponents() {
panel1 = new java.awt.Panel();
getContentPane().add(panel1, java.awt.BorderLayout.CENTER);
// </editor-fold>
// Variables declaration - do not modify
private java.awt.Panel panel1;
// End of variables declaration
}

Similar Messages

  • Compiling error......class or interface expected

    here is what it said in my command prompt
    C:\j2sdk1.4.2_05\bin>javac C:\Java\Converter.java
    C:\Java\Converter.java:16: 'class' or 'interface' expected
    ^
    1 error
    and by the way sorry if this posted twice my computer is being a little annoying tonight

    here ill put the whole thing of code......dont laugh if its crappy i just started learnign this shit
    //this program requests an amount of money and gives the number of quarters, nickels, dimes, and pennies there are. The amount of money must not be less than zero.
    public class Converter
         public static void main(String[]args)
              String input;
              input = JOptionPane.showInputDialog("Enter Dollar Amount");
         public static void main(String[]args)
              String output;
              output = JOptionPane.showMessageDialog(null, "messageString", "Converter", JOptionPane.amountOfQuarters);
    public class Dollars
         String dollars; // dollar amount
         int quarters; // quarter amount
         int dimes; // dime amount
         int nickels; // nickel amount
         int pennies; // penny amount
         public Dollars(String d, int q, int d, int n, int p)
              quarters = q;
              dimes = d;
              nickels = n;
              pennies = p;
              dollars = d;
    and this is just the start i guess you could say.....i gotta make this do some equations and other crap

  • Class or interface expected in Javabeans

    Hi Netbeans Guru,
    I have run out of ideas when trying to run the Juggler example below from Chapter 22: JavaBeans, Learning Java published by Oreilly in
    Netbeans 5.0, Windows XP:
    * LearningJava1.java
    * Created on 3 August 2006, 02:59
    * @author abc
    import javax.swing.*
    public class LearningJava1 extends javax.swing.JFrame {
    /** Creates new form LearningJava1 */
    public LearningJava1() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
    juggler1 = new magicbeans.sunw.demo.juggler.Juggler();
    jButton1 = new javax.swing.JButton();
    getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    juggler1.setAnimationRate(500);
    org.jdesktop.layout.GroupLayout juggler1Layout = new org.jdesktop.layout.GroupLayout(juggler1);
    juggler1.setLayout(juggler1Layout);
    juggler1Layout.setHorizontalGroup(
    juggler1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 144, Short.MAX_VALUE)
    juggler1Layout.setVerticalGroup(
    juggler1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
    .add(0, 125, Short.MAX_VALUE)
    getContentPane().add(juggler1, new org.netbeans.lib.awtextra.AbsoluteConstraints(240, 70, -1, -1));
    jButton1.setText("Start");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 220, -1, -1));
    pack();
    }// </editor-fold>//GEN-END:initComponents
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    juggler1.setJuggling(true);
    }//GEN-LAST:event_jButton1ActionPerformed
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new LearningJava1().setVisible(true);
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButton1;
    private magicbeans.sunw.demo.juggler.Juggler juggler1;
    // End of variables declaration//GEN-END:variables
    This program failed to compiled with the message "Class or interface expected" when declaring the JavaLearning1 constructor (line 17) and the private juggler1 variable (last line of code). It is not possible to see the code within initComponents methods in Netbeans Source Workspace. Is it possible that this is due to CLASSPATH not set correctly?
    I am new to JavaBeans and would appreciate any guidances.
    Many Thanks,
    Netbeans Fan

    Hi itchyscratchy,
    Thanks for pointing the missing semi colon out but it was just a copy & paste error. The import statement does have the semi colon in it. Nevertheless, below is the output when compiling from Netbeans:
    init:
    deps-jar:
    Compiling 1 source file to C:\Documents and Settings\abc\Java Tutorial\build\classes
    C:\Documents and Settings\abc\Java Tutorial\src\LearningJava1.java:17: 'class' or 'interface' expected
    public LearningJava1() {
    C:\Documents and Settings\abc\Java Tutorial\src\LearningJava1.java:76: 'class' or 'interface' expected
    private magicbeans.sunw.demo.juggler.Juggler juggler1;
    C:\Documents and Settings\abc\Java Tutorial\src\LearningJava1.java:79: 'class' or 'interface' expected
    C:\Documents and Settings\abc\Java Tutorial\src\LearningJava1.java:80: 'class' or 'interface' expected
    4 errors
    BUILD FAILED (total time: 1 second)
    Thanks,
    Netbeans Fan

  • Compilation Error: "class or interface expected" for simple EAR???

    Dear all,
    I have access to the customers NW CE 7.1 SP07 and of course I am using the corresponding NWDS 7.1 SP07 that comes with this CE installation. I am trying to study JEE 5 @ SAP and I have created a very simple Application (from the Book http://www.sap-press.de/katalog/buecher/titel/gp/titelID-1480).
    In NWDS I have created the following 4 projects:
    1. Dictionary Project
    Describes 2 Tables (TMP_EMPLOYEES and TMP_ID_GEN)
    2. EJB 5 Project
    Contains a stateless EJB + local business interface + Entity class.
    The EJB accesses the entity class, which is mapped to a simple table (TMP_EMPLOYEES).
    3. Dynamic Web Project
    Contains actually only one JSP (index.jsp) which allows to the local business interface for creating a new Entity.
    4. Enterprise Application Project (EAR)
    Creates a package from 2. and 3.
    I have successfully deployed both the Dictionary Project and the EAR (all to the same server).
    But If I call the corresponding URL via web browser I get the following error:
    500   Internal Server Error
    "Error in compiling [/EmployeeWeb/index.jsp] in application [sap.com/EmployeeEar]."
    Details: "The WebApplicationException log ID is [005056841108002A00000070000007AC0139C8D8862D3EED]."
    In the "Log Viewer" of the "SAP NetWeaver Administrator" (via browser...) I have found the following:
    Message: Processing HTTP request to servlet [jsp] finished with error.
    The error is: com.sap.engine.services.servlets_jsp.server.jsp.exceptions.CompilingException: Error in executing the compilation process: [ Compilation Failed! Exit Code=1
    Command line executed: D:\usr\sap\CED\J00\exe\sapjvm_5\bin\\javac -source 1.5 -target 1.5 -encoding UTF-8 -d "D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work" -sourcepath "D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work\;" -classpath ".;D:\usr\sap\CED\J00\exe\jstartup.jar;D:\usr\sap\CED\J00\exe\sapjvm_5\lib\jvmx.jar;D:\usr\sap\CED\J00\exe\jre\lib\iqlib.jar;D:\usr\sap\CED\J00\exe\sapjvm_5\lib\tools.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\boot\sap.com~tc~bl~jkernel_boot~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\boot\jaas.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~bytecode~library.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\boot\memoryanalyzer.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\jperflib.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\jta.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~bytecode~library.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~cache_api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~frame~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~gui~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~iqlib~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jdsr~jdsr.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_cache~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_classload~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_cluster~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_configuration~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_database~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_licensing~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_locking~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_log~api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_pool~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_service~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_thread~frame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~jkernel_util~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~bl~opensqlkernel~implOpenSQLFrame.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~exception~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~je~sessionmgmt~api_assembly.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~logging~java~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\sap.com~tc~logging~java~implPerf.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\system\vmc_storage_provider.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\timeout\sap.com~tc~je~timeout~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\servlet\servlet.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\cross_api\sap.com~tc~je~cross_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~antlr~runtime.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~bl~config~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~bl~cpt~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~bl~jarm~jarm.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~bl~opensqlkernel~implOpenSQL.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~bl~opensqlkernel~implOpenSQLPort.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~dd~db~dictionarydatabase~implDictionaryDatabase.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~je~bootstrap_core_lib~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\core_lib\sap.com~tc~sec~secstorefs~java~core.jar;D:\usr\sap\CED\J00\exe\mssjdbc\sqljdbc.jar;D:\usr\sap\CED\SYS\global\security\lib\engine\iaik_jce.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\log\sap.com~tc~je~log_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\mail.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\sap.com~tc~je~javamail_lib~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\activation.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\iaik_jsse.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\iaik_smime.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\iaik_ssl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\mail-activation-iaik\w3c_http.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.security.api.sda\sap.com~tc~sec~ume~api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.security.api.sda\sap.com~tc~sec~ume~perm~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\security_api\sap.com~tc~je~security_api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\shell\sap.com~tc~je~shell_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\cross\sap.com~tc~je~cross~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\visual_administration\sap.com~tc~bl~visual_administration~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\shell\sap.com~tc~je~shell~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\p4\sap.com~tc~je~p4~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sapxmltoolkit\sap.com~tc~sapxmltoolkit~sapxmltoolkit.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jts\jts.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~jmx\sap.com~tc~bl~pj_jmx~Impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~mmodel~lib\sap.com~tc~je~mmodel~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\appcontext_api\sap.com~tc~je~appcontext_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\naming\sap.com~tc~je~naming~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\j2eeca\connector.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\idl\idl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\resourceset_api\sap.com~tc~bl~resourceset~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\resourcecontext_api\sap.com~tc~bl~resourcecontext~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~txmanager~plb\sap.com~tc~bl~txmanagerimpl~plb~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\transactionext_api\sap.com~tc~bl~transactionext~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\ts\sap.com~tc~je~ts~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\csiv2_api\sap.com~tc~bl~csiv2~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\iiop\sap.com~tc~je~iiop~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\file\sap.com~tc~je~file~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.tc.Logging\sap.com~tc~logging~standard~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~bcanalysis\sap.com~tc~je~bcanalysis~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~reference_graph\lib\tc~bl~reference_graph_api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\container_api\sap.com~tc~je~container_api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\webservices\sap.com~tc~je~webservices_api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.util.monitor.jarm\sap.com~tc~bl~jarmsat~jarmsat.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~i18n~verify~intf\sap.com~tc~i18n~verify~intf~jar~IMPL.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~i18n~cp\sap.com~tc~i18n~cp~jar~IMPL.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~i18n~decfloat\sap.com~tc~i18n~decfloat~jar~IMPL.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~com.sap.conn.jco\sap.com~tc~bl~jco_sapj2ee~runtime.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.mw.jco\sap.com~tc~bl~jrfc~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\keystore_api\sap.com~tc~je~keystore_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\tc~sec~certrevoc~interface\sap.com~tc~sec~certrevoc~interface~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~https~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~compat~core.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~ssf~core.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~jaas~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~saml~toolkit~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~csi~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~util0~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~userstore~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~xmlbind~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\security.class\sap.com~tc~sec~destinations~lib~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.guid\sap.com~tc~bl~guidgenerator~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\stax_api\jsr173_1.0_api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\stax_api\sjsxp.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jaxb20\jaxb-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jaxb20\jaxb-xjc.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jaxb20\jaxb-impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\saaj13\saaj-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\saaj13\saaj-impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jaxws_api\jaxws-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jws_api\jsr181-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\javax~annotation~api\annotation-api-1.0.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\compilation_lib\sap.com~tc~bl~compilation~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\sap.com~tc~bl~base_webservices_lib.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\jaxm-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\jaxrpc-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\jaxr-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\jaxws-rt.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~base_webservices_lib\jaxws-tools.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~j2eedescriptors~lib\sap.com~tc~je~j2eedescriptors~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~ejb~metadata~model\lib\sap.com~tc~bl~ejb~metadata~model.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\javax~persistence~api\persistence-api-1.0.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\ejbormapping_api\sap.com~tc~je~ejbormapping_api~API.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~orpersistence~metadata~model\sap.com~tc~bl~orpersistence~metadata~model.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~util.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlin~core.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~lib.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~ear.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~connector.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~web.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~ejb.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~appclient.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jlinee~lib\sap.com~tc~jtools~jlinee~orpersistence.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\deploy\sap.com~tc~je~deploy~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\jmx_notification\sap.com~tc~je~jmx_notification~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\runtimeinfo\sap.com~tc~je~runtimeinfo~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\jmx\sap.com~tc~je~jmx~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\jmx\sap.com~tc~je~jmx~impl~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\http\sap.com~tc~je~httpserver~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~exprlang~plb\jee5_el.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jstl\jstl-1_2.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~injection~lib\lib\private\tc~je~injection.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\ec~java~jsf_api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\ec~java~jsf~tld.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\private\com-sun-commons-beanutils.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\private\com-sun-commons-collections.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\private\com-sun-commons-digester.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\private\com-sun-commons-logging-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ec~java~jsf\lib\private\ec~java~jsf_core.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~je~jacc~plb\jacc-1_1-fr-class.zip;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\classpath_resolver\sap.com~tc~je~classpath_resolver~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.ip.basecomps\sap.com~tc~bl~basecomps~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sdo\lib\sap.com~sdo.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sdo\lib\sap.com~sdo~api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sdo\lib\sap.com~sdo~api~extension.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ejb_api\ejb-3_0-api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\webservices_lib\sap.com~tc~je~webservices_lib~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~i18n~saptimezone\sap.com~tc~i18n~saptimezone~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~i18n~cpbase\sap.com~tc~i18n~cpbase~jar~IMPL.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.security.core.sda\sap.com~tc~sec~ume~core~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.security.core.sda\sap.com~tc~sec~ume~tpd~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jms\jms.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\jms\jmsclient.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\com.sap~tc~je~jmsapi\sap.com~tc~je~jmsapi~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\userstore\sap.com~tc~je~userstore~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~SL~utility\sap.com~tc~bl~sl~utility~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\com.sap.exception\sap.com~tc~exception~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc~bl~jarsap~sda\sap.com~tc~bl~jarsap~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\tc~bl~deploy_api\sap.com~tc~bl~deploy~api.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\tc.httpclient\sap.com~tc~clients~http~all.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\tc~sec~destinations~interface\sap.com~tc~sec~destinations~interface_api~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\endpoint_api\sap.com~tc~bl~endpoint~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\connector\sap.com~tc~je~connector~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\antlr\sap.com~tc~antlr~runtime.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\dbpool\sap.com~tc~je~dbpool~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\tc~sec~destinations~provider\sap.com~tc~sec~destinations~provider~java~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\com.sap.security.core.ume.service\sap.com~tc~sec~ume~service~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sap.com~tc~je~constants~lib\lib\tc~je~constants.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\schemaprocessor~srv\sap.com~tc~je~schemaprocessor.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\tc~je~webcontainer~api\sap.com~tc~je~webcontainer~webcontainer_api_impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\servlet_jsp\sap.com~tc~je~webcontainer~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\objectProfiler\sap.com~tc~bl~objectProfiler~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\tc~je~cachemgmt~srv\sap.com~tc~je~cachemgmt~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\locking\sap.com~tc~je~locking~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\configuration\sap.com~tc~je~configuration~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\basicadmin\sap.com~tc~je~basicadmin~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\basicadmin\jstartupapi.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\basicadmin\jstartupimpl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\adminadapter\sap.com~tc~je~adminadapter~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\security\sap.com~tc~je~security~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\applocking\sap.com~tc~je~applocking~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ejb20\ejb20.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ejbqlparser\sap.com~tc~bl~ejbqlparser~lib.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\ejbqlparser\sap.com~tc~bl~ejbqlparser_3_0~lib.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sqlmapper\sap.com~tc~bl~ejbsqlmapper~implCommonSQLMapper.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\sqlmapper\sap.com~tc~bl~ejbsqlmapper~implSQLMapperAPI.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\interfaces\ejbmonitor_api\sap.com~tc~bl~ejbmonitor~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\services\ejb\sap.com~tc~je~ejb~impl.jar;D:\usr\sap\CED\J00\j2ee\cluster\bin\ext\orpersistence_client_lib\lib\orpersistence_client_lib_api.jar;D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\orpersistence\jars\EmployeeEjb.jar;D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\EJBContainer\applicationjars\EmployeeEjb.jar;D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work;;" -nowarn -g ["D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work\JEE_jsp_index_8832250_1231538390011_1231538444324.java"]
    Error stream contains:"D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work\JEE_jsp_index_8832250_1231538390011_1231538444324.java:16: 'class' or 'interface' expected
    import javax.servlet.*;
    ^
    D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work\JEE_jsp_index_8832250_1231538390011_1231538444324.java:17: 'class' or 'interface' expected
    import javax.servlet.http.*;
    ^
    D:\usr\sap\CED\J00\j2ee\cluster\apps\sap.com\EmployeeEar\servlet_jsp\EmployeeWeb\work\JEE_jsp_index_8832250_1231538390011_1231538444324.java:18: 'class' or 'interface' expected
    import javax.servlet.jsp.*;
    ^
    3 errors
    "].005056841108002A00000070000007AC0139C8D8862D3EED Date: 2009-01-09 Time: 23:00:45:042 Category: /System/Server/WebRequests Location: com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl Application: sap.com/EmployeeEar Thread: HTTP Worker [4] Data Source: j2ee\cluster\server0\log\system\server_00.log Correlator ID: 88322500000038637 Argument Objects: Arguments: DSR Component: n.a. DSR Transaction: 10c493a0de9311dd9631005056841108 DSR User: Message Code: Session: 979 Transaction: User: Guest Host: IMGNWCED System: CED Instance: J00 Node: server0
    As you can see there is some compilation error, it says 3 times "'class' or 'interface' expected". If i remove all the relevant EJB java code from my index.jsp everything works fine. So I guess there must be some problem with finding the resources. Unfortunately this "logging" is not helpful at all (thank you SAP!). In NWDS everything is fine no problems at all!!!
    Who can help me here with this?
    Thanks in Advance

    I have found the issue.
    in the index.jsp I have the following lines:
    <!-- Import Statements -->
    <%@ page import="javax.naming.InitialContext" %>
    <%@ page import="com.sap.demo.session.EmployeeServicesLocal;" %>
    Now check the end of the second import ==> ;
    Removing the semicolon solves the issue. But the SAP error message is still not very helpful to me.

  • Compile Error: 'class' or 'interface' expected

    Hi all,
    I have a code which was compiling/running successfully:
    import java.net.*;
    code
    When I added the line: import java.io.*;
    import java.net.*;
    import java.io.*;
    code
    Got the following compile error:
    'class' or 'interface' expected
    import java.io.*;
    ^
    If I comment one of my import statements then it compiles, but I can't have both!
    Does anybody know what's the problem? where it comes from?
    Any help is greatly appreciated.

    I haven't post the entire code b/c it's very long, anyway here it is...
    import java.net.*; ;
    import java.io.*;
    //class TransactionOp: #1
    class TransactionOp
    int ID = 0;
    double price = 0.0;
    int subsID = 0;
    String xmlDoc = "";
    String xmlResp = "";
    String respID = "";
    String authCode = "";
    int opResult = 0;
    public TransactionOp(int anID, double aPrice, int aSubID)
         ID = anID;
         price = aPrice;
         subsID = aSubID;     
         //op done values: 1: REF, 2: DCL, 3: AUTH, 4: AUTH_NoID
         //op errors: -1: noResponse, -2: noAuthResp, -3: noStatus, -4: no gw.
    //class AddressCC: #2
    class AddressCC
    String zipcode = "";
    String city = "";
    String state = "";
    String country = "";
    String address1 = "";
    public AddressCC(String addr1, String city1, String state1, String country1, String zipcode1)
         address1 = addr1;
         city = city1;
         state = state1;
         country = country1;
         zipcode = zipcode1;
    //class InfoCC: #3
    class InfoCC
    String fullName = "";
    String number = "";
    String expDate = "";
    public InfoCC(String name, String number1, String date)
         fullName = name;
         number = number1;
         expDate = date;
    public class SurePayGW
    //instance fields
    private String merchant = "";//merchant = aMode
    private String password = "";
    private String server = "";
    private int subsID = 0;
    public SurePayGW()
         merchant = "34593";
         password = "hnbv78hj6";
         server = "xml.surepay.com";     
    }//endof constructor:SurePayGW
    //String formattedS = "\"" + s + "\"";
    public void spitDoc(SurePayGW sp, AddressCC address, InfoCC ccInfo, TransactionOp trans)
         String xmlBuf = "<!DOCTYPE pp.request PUBLIC \"-//IMALL//DTD PUREPAYMENTS 1.0//EN\" \"http://www.purepayments.com/dtd/purepayments.dtd\">";     
         xmlBuf = xmlBuf + "<pp.request merchant=" + "\"" + sp.merchant+ "\" password=" + "\"" + sp.password+ "\">";
         xmlBuf = xmlBuf + "<pp.auth ecommerce=\"true\" ordernumber=" + "\"" + trans.ID + "\" recurring=\"false\">";     
         xmlBuf = xmlBuf + "<pp.creditcard number=" + "\"" + ccInfo.number + "\" expiration=" + "\"" + ccInfo.expDate.charAt(0) + ccInfo.expDate.charAt(1)+ "/" + ccInfo.expDate.charAt(2) + ccInfo.expDate.charAt(3) + "\">";          
         xmlBuf = xmlBuf + "<pp.address type=\"billing\" zip=" + "\"" + address.zipcode + "\" city=" + "\"" + address.city + "\" state=" + "\"" + address.state + "\" country=" + "\"" + address.country + "\" fullname=" + "\"" + ccInfo.fullName + "\" address1=" + "\"" + address.address1 + "\"/>";
         xmlBuf = xmlBuf + "</pp.creditcard>";     
         xmlBuf = xmlBuf + "<pp.address type=\"shipping\" zip=" + "\"" + address.zipcode + "\" city=" + "\"" + address.city + "\" state=" + "\"" + address.state + "\" country=" + "\"" + address.country + "\" fullname=" + "\"" + ccInfo.fullName + "\" address1=" + "\"" + address.address1 + "\"/>";     
         xmlBuf = xmlBuf + "<pp.lineitem sku=\"R" + trans.subsID + "Zg\" description=\"Subscription Renewal\" taxrate=\"0\" quantity=\"1\" unitprice=\"" + trans.price + "USD\"/>";
         xmlBuf = xmlBuf + "</pp.auth></pp.request>";
         //print("@DBG [SurePayDoc.submitTransaction]: will send %s" % xmlBuf)
         trans.xmlDoc= xmlBuf;
         //System.out.println("This the final result of xmlBuf: ");
         //System.out.println(xmlBuf);
         //System.out.println("trans.xmlDoc = " + trans.xmlDoc);
    }//endof m: spitDoc
    public void submitTransaction(SurePayGW sp, TransactionOp aTrans)
         String param = "";
         HttpURLConnection connection;
         URL url;
         String urlString = "";
         String input = "";
         String response = "";
         try
              //params= urllib.urlencode({'xml' : aTrans.xmlDoc})
              param = java.net.URLEncoder.encode(aTrans.xmlDoc, "UTF-8");
              //System.out.println("The output from java.net.URLEncoder.encode: " + param);
              //link= httplib.HTTPSConnection(self.server)
              urlString = "https://" + sp.server;
              url = new URL(urlString);
              connection = (HttpURLConnection)url.openConnection();          
              System.out.println(connection.getURL());          
              System.out.println(connection.getResponseCode() + " " + connection.getResponseMessage());          
              System.out.println(connection.getURL());
              connection.setDoInput(true);
              connection.setDoOutput(true);
              connection.setUseCaches(false);
              //link.putrequest('POST', '/')
         connection.setRequestMethod("POST");
              //link.putheader('Content-type', 'application/x-www-form-urlencoded')
              //link.putheader('Content-length', ("%d" % len(params)))
              //link.putheader('Accept', 'text/plain')
              connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
              connection.setRequestProperty("Content-length", param.length());
              connection.setRequestProperty("Accept", "text/plain");
              //link.endheaders()
              connection.connect();
              System.out.println("Client : Connected");
              //link.send(params)
              //response= link.getresponse()
              //data= response.read()     
              DataOutputStream out = new DataOutputStream(connection.getOutputStream());
              System.out.println("Client : Writing Content");
              out.writeBytes(content);
              System.out.println("Client : Flushing Stream");
              out.flush();
              System.out.println("Client : Waiting for response from Server");
              BufferedReader in = new BufferedReader(new InputStreamReader(http.getInputStream()));
              System.out.println("Client : Opened input stream");
              while((input = in.readLine()) != null)
                   response += input + "\r";
              System.out.println("Client : received : "+response);
              //I'm not bothering to close the streams or http connection yet.
         }//endof: try
         catch (MalformedURLException e)
              e.printStackTrace();
         catch (Exception e)
              e.printStackTrace();
    }//endof m:submitTransaction
    }//endof class:SurePayGW

  • Class or interface expected

    I am very new to java and need to do an assignment for my course. I am trying to get a connection to a database and retrieve information but I get the below error when I try to compile my program - any ideas?
    D:\javawork\Bike.java:16: 'class' or 'interface' expected
    public Bike()
    ^
    Here is the actual code:
    //Bike Class
    import java.sql.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.*;
    import java.util.*;
    import java.lang.*;
    public class Bike extends JFrame
         private Connection Database;
         private JTable table;
    public Bike()
         // Use JDBC to connect to a Microsoft ODBC source
         String url = "jdbc:odbc:Mikesdb";
         String username = "guest";
         String password = "guest";
         Statement DataRequest;
         ResultSet Results;
         //Load the driver to allow connection to the database
         try
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              Database = DriverManager.getConnection(url);
              System.out.println("Successful Connection" + Database);
         catch(ClassNotFoundException cnferr)
              System.err.println("Failed to load JDBC/ODBC bridge" + cnferr);
              System.exit(1); //exit program
         catch(SQLException sqlex)
              System.err.println("Unable to connect to the database" + sqlex);
              System.exit(2); //exit program
         FindBike();
         setSize(200,200);
         show();
    public void FindBike(String type, String gender, String status)
         String t = type;
         String g = gender;
         String s = status;
         this.getConnection();
         Statement DataRequest;
         ResultSet Results;
         try
              //get user input for three fields in future
              String query = "Select * FROM Bike WHERE Status = 'Ready'";
              DataRequest = Database.createStatement();
              Results = DataRequest.executeQuery (query);
              displayResults (Results);
              DataRequest.close();
         catch(SQLException err)
              System.out.println("SQL Error: " + err);
              System.exit(3);
    public void Disconnect()
         try
              Database.close();
         catch(SQLException err)
              System.out.println("Cannot close database connection: " + err);
              System.exit(4);
    public static void main(String[] arguments) {
         Bike b = new Bike();
         b.show();
         

    Having moved the { to the end I get lots of new errors!
    D:\javawork\Bike.java:49: FindBike(java.lang.String,java.lang.String,java.lang.String) in Bike cannot be applied to ()
         FindBike();
    ^
    D:\javawork\Bike.java:60: cannot resolve symbol
    symbol : method getConnection ()
    location: class Bike
         this.getConnection();
    ^
    D:\javawork\Bike.java:71: cannot resolve symbol
    symbol : method DisplayResults (java.sql.ResultSet)
    location: class Bike
              DisplayResults (Results);
    ^
    3 errors
    Finished

  • How to fix 'class' or 'interface' expected for jsp

    below is the stack trace
    org.apache.jasper.JasperException: Unable to compile class for JSP
    Generated servlet error:
    /home/sherali/.netbeans/5.5/apache-tomcat-5.5.17_base/work/Catalina/localhost/UVSDataSearch/org/apache/jsp/pager_002ddemo_jsp.java:7: 'class' or 'interface' expected
    import java.util.*;
    ^
    Generated servlet error:
    /home/sherali/.netbeans/5.5/apache-tomcat-5.5.17_base/work/Catalina/localhost/UVSDataSearch/org/apache/jsp/pager_002ddemo_jsp.java:8: 'class' or 'interface' expected
    import java.io.*;
    ^
    2 errors
    thanks a lot in advance.
    my jsp is
    <%@ page session="false" %>
    <%@ page import="tauvex.*;" %>
    <%@ page import="java.util.*" %>
    <%@ page import="java.io.*" %>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@ taglib uri="http://jsptags.com/tags/navigation/pager" prefix="pg" %>
    <html>
    <head>
    <title>Tauvex Search Results</title>
    <%
    * Pager Tag Library
    * Copyright (C) 2002 James Klicman <[email protected]>
    * The latest release of this tag library can be found at
    * http://jsptags.com/tags/navigation/pager/
    * This library is free software; you can redistribute it and/or
    * modify it under the terms of the GNU Lesser General Public
    * License as published by the Free Software Foundation; either
    * version 2.1 of the License, or (at your option) any later version.
    * This library is distributed in the hope that it will be useful,
    * but WITHOUT ANY WARRANTY; without even the implied warranty of
    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    * Lesser General Public License for more details.
    * You should have received a copy of the GNU Lesser General Public
    * License along with this library; if not, write to the Free Software
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    %>
    <style type="text/css">
    A.nodec { text-decoration: none; }
    </style>
    </head>
    <body bgcolor="#ffffff">
    <%
    String style = getParam(request, "style", "simple");
    String position = getParam(request, "position", "top");
    String index = getParam(request, "index", "center");
    int maxPageItems = getParam(request, "maxPageItems", 3);
    int maxIndexPages = getParam(request, "maxIndexPages", 3);
    %>
    <%
    String query1=(String)request.getAttribute("query1");
    String query=(String)request.getAttribute("query");
    String ShowFile=(String)request.getAttribute("ShowFile");
    String ShowRA=(String)request.getAttribute("ShowRA");
    String ShowDEC=(String)request.getAttribute("ShowDEC");
    String Telescope=(String)request.getAttribute("Telescope");
    String ObservationDates=(String)request.getAttribute("ObservationDates");
    String Filter=(String)request.getAttribute("Filter");
    String RA=(String)request.getAttribute("RA");
    String DEC=(String)request.getAttribute("DEC");
    String DATE=(String)request.getAttribute("DATE");
    String DATE1=(String)request.getAttribute("DATE1");
    String Radious=(String)request.getAttribute("Radious");
    String FILTER[]=(String[])request.getAttribute("FILTER");
    String OrderBy1=(String)request.getAttribute("OrderBy1");
    String OrderBy2=(String)request.getAttribute("OrderBy2");
    String OrderBy3=(String)request.getAttribute("OrderBy3");
    %>
    <%
    out.println("<form action=\"PlainSQLQuery\" method=POST>");
    out.println("<textarea rows = 5 cols = 40 name=query id=\"query\">");
    out.println(query);
    out.println("</textarea>");
    out.println("<input type = submit value = \"Submit\">");
    out.println("<input type = reset value = \"Reset\">");
    out.println("</form>");
    %>
    <center>
    <table border="0" width="90%" cellpadding="4">
    <tr>
    <td colspan="2" align="left" valign="top">
    <table border="0" cellspacing="2" cellpadding="0">
    <tr><td>Max. Page Items </td>
    <td><input type="text" size="4" name="maxPageItems" value="<%= maxPageItems %>" onChange="this.form.submit();"></td></tr>
    <tr><td>Max. Index Pages </td>
    <td><input type="text" size="4" name="maxIndexPages" value="<%= maxIndexPages %>" onChange="this.form.submit();"></td></tr>
    </table>
    </td>
    </tr>
    </table>
    <pg:pager
    index="<%= index %>"
    maxPageItems="<%= maxPageItems %>"
    maxIndexPages="<%= maxIndexPages %>"
    url="TauvexDataServlet"
    export="offset,currentPageNumber=pageNumber"
    scope="request">
    <%-- keep track of preference --%>
    <pg:param name="style"/>
    <pg:param name="position"/>
    <pg:param name="index"/>
    <pg:param name="maxPageItems"/>
    <pg:param name="maxIndexPages"/>
    <pg:param name="RA"/>
    <pg:param name="DEC"/>
    <pg:param name="DATE"/>
    <pg:param name="DATE1"/>
    <pg:param name="Radious"/>
    <pg:param name="FILTER"/>
    <pg:param name="ShowRA"/>
    <pg:param name="ShowDEC"/>
    <pg:param name="Telescope"/>
    <pg:param name="ObservationDates"/>
    <pg:param name="Filter"/>
    <pg:param name="OrderBy1"/>
    <pg:param name="OrderBy2"/>
    <pg:param name="OrderBy3"/>
    <%-- save pager offset during form changes --%>
    <input type="hidden" name="pager.offset" value="<%= offset %>">
    <%-- warn if offset is not a multiple of maxPageItems --%>
    <% if (offset.intValue() % maxPageItems != 0 &&
    ("alltheweb".equals(style) || "lycos".equals(style)) )
    %>
    <p>Warning: The current page offset is not a multiple of Max. Page Items.
    <br>Please
    <pg:first><a href="<%= pageUrl %>">return to the first page</a></pg:first>
    if any displayed range numbers appear incorrect.</p>
    <% } %>
    <%-- the pg:pager items attribute must be set to the total number of
    items for index before items to work properly --%>
    <% if ("top".equals(position) || "both".equals(position)) { %>
    <br>
    <pg:index>
    <% if ("texticon".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/texticon.jsp" flush="true"/>
    <% } else if ("jsptags".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/jsptags.jsp" flush="true"/>
    <% } else if ("google".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/google.jsp" flush="true"/>
    <% } else if ("altavista".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true"/>
    <% } else if ("lycos".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/lycos.jsp" flush="true"/>
    <% } else if ("yahoo".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/yahoo.jsp" flush="true"/>
    <% } else if ("alltheweb".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/alltheweb.jsp" flush="true"/>
    <% } else { %>
    <jsp:include page="/WEB-INF/jsp/simple.jsp" flush="true"/>
    <% } %>
    </pg:index>
    <% } %>
    <hr>
    <form action="ZipServlet" method="get" name="download" onsubmit="return Form1_Validator(this)">
    <table id="output">
    <CAPTION><EM>Fits file Search Results</EM></CAPTION><tr>
    <%
    out.println("<th>Check Box</th>");
    out.println("<th>File Name</th>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<th>RA_START</th>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<th>RA_END</th>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<th>DEC_START</th>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<th>DEC_END</th>");
    if(Telescope!=null && "on".equals(Telescope))
    out.println("<th>Telescope</th>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println("<th>STARTOBS</th>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println("<th>ENDOBS</th>");
    if(Filter!=null && "on".equals(Filter))
    out.println("<th>FILTER</th>");
    out.println("</tr>");
    %>
    <%--
    <table width="90%" cellspacing="4" cellpadding="4">
    Since the data source is static, it's easy to offset and limit the
    loop for efficiency. If the data set size is not known or cannot
    be easily offset, the pager tag library can count the items and display
    the correct subset for you.
    The following is an example using an enumeration data source of
    unknown size. The pg:pager items and isOffset attributes must
    not be set for this example:
    --%>
    <%
    Enumeration myDataList1 = (Enumeration)request.getAttribute("myDataList1");
    if (myDataList1 == null)
    throw new RuntimeException("myDataList1 is null");
    %>
    <% while (myDataList1.hasMoreElements()) { %>
    <% TauvexData elem = (TauvexData)myDataList1.nextElement(); %>
    <pg:item> <%
    out.println("<tr>");
    %>
    <td><input type= "checkbox" name="cb" value="<%=elem.getDownload()%>"></td>
    <td><a href="<%= elem.getDownload() %>"><%= elem.Fitsfilename %></a></td>
    <%
    // out.println("<td> "+elem.Fitsfilename+" </td>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<td> "+elem.RA_START+" </td>");
    if(ShowRA != null && "on".equals(ShowRA))
    out.println("<td> "+elem.RA_END+"</td>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<td> "+elem.DEC_START+" </td>");
    if(ShowDEC != null && "on".equals(ShowDEC))
    out.println("<td> "+elem.DEC_END+" </td>");
    if(Telescope!=null && "on".equals(Telescope))
    out.println("<td> "+elem.telescope+" </td>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println("<td> "+elem.STARTOBS+" </td>");
    if(ObservationDates !=null && "on".equals(ObservationDates))
    out.println(" <td> "+elem.ENDOBS+" </td>");
    if(Filter!=null && "on".equals(Filter))
    out.println("<td> "+elem.FILTER+" </td>");
    out.println("</tr>");
    %> </pg:item>
    <% } %>
    </table>
    <input type="button" name="CheckAll" value="Check All Boxes" onclick="modify_boxes(true,3)">
    <input type="button" name="UnCheckAll" value="UnCheck All Boxes" onclick="modify_boxes(false,3)">
    <input type="submit" value="Download">
    </form>
    <hr>
    <pg:pages>
    <a href="<%= pageUrl %>"><%= pageNumber %></a>
    </pg:pages>
    <pg:last>
    <a href="<%= pageUrl %>">[ Last >| (<%= pageNumber %>) ]</a>
    </pg:last>
    <% if ("bottom".equals(position) || "both".equals(position)) { %>
    <pg:index>
    <% if ("texticon".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/texticon.jsp" flush="true"/>
    <% } else if ("jsptags".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/jsptags.jsp" flush="true"/>
    <% } else if ("google".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/google.jsp" flush="true"/>
    <% } else if ("altavista".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/altavista.jsp" flush="true"/>
    <% } else if ("lycos".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/lycos.jsp" flush="true"/>
    <% } else if ("yahoo".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/yahoo.jsp" flush="true"/>
    <% } else if ("alltheweb".equals(style)) { %>
    <jsp:include page="/WEB-INF/jsp/alltheweb.jsp" flush="true"/>
    <% } else { %>
    <jsp:include page="/WEB-INF/jsp/simple.jsp" flush="true"/>
    <% } %>
    </pg:index>
    <% } %>
    </pg:pager>
    </center>
    </body>
    </html>
    <%!
    private static int num =1;
    private static String getName(){
    String str="cb";
    str=str+num;
    num++;
    return str ;
    private static final String getParam(ServletRequest request, String name,
    String defval)
    String param = request.getParameter(name);
    return (param != null ? param : defval);
    private static final int getParam(ServletRequest request, String name,
    int defval)
    String param = request.getParameter(name);
    int value = defval;
    if (param != null) {
    try { value = Integer.parseInt(param); }
    catch (NumberFormatException ignore) { }
    return value;
    private static void radio(PageContext pc, String name, String value,
    boolean isDefault) throws java.io.IOException
    JspWriter out = pc.getOut();
    String param = pc.getRequest().getParameter(name);
    out.write("<input type=\"radio\" name=\"");
    out.write(name);
    out.write("\" value=\"");
    out.write(value);
    out.write("\" onChange=\"this.form.submit();\"");
    if (value.equals(param) || (isDefault && param == null))
    out.write(" checked");
    out.write('>');
    %>

    Well, putting all that Java code into a JSP was a bad idea in the first place, just on general design principles. But you've done it in such a way that the result of compiling the JSP is malformed Java code. Frankly I would just throw it away and put the Java code into a servlet or some other Java class, where it belongs.
    But if you're really working in a place where nobody has learned anything since 2003, and you're forced to support that old junk, then I would point out that the error occurs before the place which generates this line:
    import java.util.*;You only need to look at two of the thousand lines of code you posted.

  • JDeveloper Error(16,8) 'class' or 'interface' expected

    I have just installed JDeveloper for 11.5.10 RUP5 OA Framework and extended the Purchase Requisition Lines EO (PoRequisitionLineEO). Everything seemed to work okay. However, in the first step of deployment, to compile the .java class, when I select Make rnPoRequisitionLineEOImpl.java, I receive the following compiler eror:
    Error(16,8): 'class' or 'interface' expected
    My sense is that this may be an environment setup issue as this is the first time I'm using JDeveloper and the first time I am extending OA Framework.
    Any advice on how to resolve?
    Edited by: Kit on Jan 29, 2010 2:42 PM

    This was an end-user error. Additional code had been added to the .java source code that was not in a class.

  • Error like 'class' or 'interface' expected

    hi,
    I write one simple program :-
    enum Apple
            a,b,c;
    public class AppleDemo
            public static void main(String args[])
                    Apple app;
                    app=Apple.a;
                    System.out.println("The Apple is:"+app);
                    app=Apple.b;
                    if(app==Apple.b)
                    System.out.println("Apple is:"+app);
    }My qry is- I am trying to compile this program.I am using j2sdk1.5.0 for compilation...but i got error that is
    *'class' or 'interface' expected*
    Thanks in advance.

    This forum is for Sun Instant Messaging related questions. For simple java questions I suggest you refer to the following forum:
    http://forums.sun.com/forum.jspa?forumID=54
    Regards,
    Shane.

  • Urgent: 'Class' or 'interface' expected

    Hello,
    I am working on a piece of work which has to be in for tomorrow, i have been trying to compile it for so,me time now and everytime i try it says 'Class' or 'interface' expected.
    I have not finished writing the program and i am not sure how correct it is. Any help would be much appreciated,
    Thank you,
    James
    Error Message: -
    U:\ManXP\My Documents\myjava>javac emailclient2.java
    emailclient2.java:181: 'class' or 'interface' expected
    private static int readListFromFile(String filename, Message[]
    ^
    messageList, int maxLines)
    1 error

    I am working on a piece of work which has to be in
    for tomorrow, i have been trying to compile it for
    so,me time now and everytime That's quite a bit of superfluous information. Please don't mark your questions as urgent. Thanks!
    i try it says 'Class' or 'interface' expected.You've got a syntax error in your code on line 181. Look at the lines before that. Are you trying to declare that method inside another method?
    Careful adherence to standard Code Conventions for the Java� Programming Language can make this type of problem very easy to spot...

  • Error :::::   Box.java:2: 'class' or 'interface' expected

    Hey ...this is sample program from "java 2 fourth edition by herbert schildt"
    Class Box()
    double width;
    double height;
    double depth;
    //display volume of the box
    void volume() {
    System.out.print("Volume is");
    System.out.println(width * height * depth);
    Class BoxDemo3
    public static void main(String args[])
    Box mybox1 = new Box();
    Box mybox2 = new Box();
    //assign values to mybox1 instance variables
    mybox1.width = 10;
    mybox1.height = 20;
    mybox1.depth = 15;
    mybox2.width = 3;
    mybox2.height = 6;
    mybox2.depth = 9;
    mybox1.volume();
    mybox2.volume();
    i have saved it as Box.java and using editplus i have compiled it then i got the error as
    Error ::::: Box.java:2: 'class' or 'interface' expected
    I think i have to import something in the code ......help me understand java
    thanx alot

    class, not Class

  • "class or interface expected error"

    hi,
    i have these two classes that am using and when i try and compile them i get a class or interface expected error.
    i have looked at previous posts and checked that i have the right number of closed brackets.
    anyone any ideas?
    import java.io.*;
    import java.net.*;
    public class BookingServer {
    public static void main(String[] args) throws IOException {
    ServerSocket serverSocket = null;
         Socket mysocket = null;
    try {
    serverSocket = new ServerSocket(4444);
    } catch (IOException e) {
    System.err.println("Could not listen on port: 4444.");
    System.exit(1);
    Socket clientSocket = null;
    try {
    clientSocket = serverSocket.accept();
    } catch (IOException e) {
    System.err.println("Accept failed.");
    System.exit(1);
    PrintWriter out = new PrintWriter(clientSocket.getOutputStream(), true);
    BufferedReader in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));
    String inputLine, outputLine;
    BookingProtocol bp = new BookingProtocol();
    outputLine = bp.processInput(null);
    out.println(outputLine);
    while ((inputLine = in.readLine()) != null) {
    out.println(inputLine);
    outputLine = bp.processInput(inputLine);
    out.println(outputLine);
    if (outputLine.equals("BYE"))
    break;
    out.close();
    in.close();
    clientSocket.close();
    serverSocket.close();
    *****************PROTOCOL***********************
    import java.io.*;
    import java.net.*;
    public class BookingProtocol {
    private static final int WAITING = 0;
    private static final int SENTLOGON = 1;
    private static final int SENTSEATREQ = 2;
    private static final int SENTSTATUSREQ = 3;
    private static final String LOGONPROMPT = "LOGON";
    private static final String SEATPROMPT = "SEAT";
    private static final String STATUSPROMPT = "STATUS";
    private static final String BYEPROMPT = "BYE";
    private int state = WAITING;
    public String processInput(String theInput) {
    String theOutput = null;
    if (state == WAITING) {
    theOutput = LOGONPROMPT;
    state = SENTLOGON;
    } else if (state == SENTLOGON) {
    theOutput = SEATPROMPT;
    state = SENTSEATREQ;
    } else if (state == SENTSEATREQ) {
    theOutput = STATUSPROMPT;
    state = SENTSTATUSREQ;
    } else if (state == SENTSTATUSREQ) {
    theOutput = BYEPROMPT;
    state = WAITING;
    return theOutput;
    in.close();
    clientSocket.close();
    serverSocket.close();

    you have too many }-brackets, the finalin.close();
    clientSocket.close();
    serverSocket.close();
    }is not inside any class

  • Java :27 class enum,interface expected

    hi all
    this code return error java:27 class enum,interface expected when run
    what wrong with it ?
    thank you
    denny
    //Find Maximum of 2 nos.
    class Maxof2{
      public static void main(String args[]){
          //taking value as command line argument.
          //Converting String format to Integer value
          int i = Integer.parseInt(args[0]);
          int j = Integer.parseInt(args[1]);
          if(i > j)
              System.out.println(i+" is greater than "+j);
          else
              System.out.println(j+" is greater than "+i);
    }

    hello all
    i find one more line at the bottom of the code ( I just copy paste from the website which give example ,and more then code area copied)
    after i remove that line
    It ok now it compiled smoothly wjthout error but now it return error when run
    the error message is :
    Exception in thread "main" java.lang.ArrayIndexOutOfboundsException: 0 at Maxof2.main(Maxof2.java:15)
    uuh how difficult java is
    denny
    tq

  • JSP Debbuging -Error: 'class' or 'interface' expected-

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

    Hi,
    Does anybody know why am I getting the following error when trying to either debug or run a JSP?
    Error: 'class' or 'interface' expected
    This happens with JDeveloper 9.0.2.829
    It was running just OK, when running from the Navigator Panel (Right click -> Run test.jsp)
    But, when I tried to run the JSP from the Debug Icon -that debugs the whole project-, I got the error I already mentioned.
    Thanks in advance for your help
    Agutin

  • ERROR: class' or 'interface' expected

    Hello, I'm new to Java. I'm having trouble figuring out this 1 error in my code. Need Help Plzzzzzz....
    java:81: 'class' or 'interface' expected
    public void actionPerformed(ActionEvent e)
    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    public class Checkerboard extends Frame implements ActionListener
         //declare variables
         int start, stop, step;
         Panel boardPanel = new Panel();
         TextArea boardDisplay [] = new TextArea[16];
         Panel buttonPanel = new Panel();
         Button goButton = new Button ("Go");
         Button clearButton = new Button("Clear");
         Panel inputPanel = new Panel();
         Label startLabel = new Label ("Start");
         TextField startField = new TextField();
         Label stopLabel = new Label ("Stop");
         TextField stopField = new TextField();
         Label stepLabel = new Label ("Step");
         TextField stepField = new TextField();
    public Checkerboard()
         this.setLayout(new BorderLayout());
         boardPanel.setLayout(new GridLayout (4, 4, 2, 3));
         inputPanel.setLayout(new FlowLayout());
         buttonPanel.setLayout(new FlowLayout());
              for (int i=0; i<16; i++)
              boardDisplay = new TextArea(null,3,5,3);
              if (i<16)
              boardDisplay[i].getText();
                   else
                   boardDisplay[i].setEditable(false);
                   boardDisplay[i].setBackground(Color.white);
                   boardPanel.add(boardDisplay[i]);
    //add components to the button
    buttonPanel.add(goButton);
    //add components to input panel
    inputPanel.add(startField);
    inputPanel.add(stopField);
    inputPanel.add(stepField);
    inputPanel.add(startLabel);
    inputPanel.add(stopLabel);
    inputPanel.add(stepLabel);
    //add panels to frame
    add(buttonPanel, BorderLayout.SOUTH);
    add(inputPanel, BorderLayout.CENTER);
    add(boardPanel, BorderLayout.NORTH);
    goButton.addActionListener(this);
    addWindowListener(new WindowAdapter()
         public void windowClosing(WindowEvent e)
              System.exit(0);
         }//end Checkerboard frame
    public void actionPerformed(ActionEvent e)
         String arg = e.getActionCommand();
         try
              if (arg == "GO")
                   start=Integer.parseInt(startTF.getText());
                   stop=Integer.parseInt(stopTF.getText());
                   step=Integer.parseInt(stepTF.getText());
                   for(int i=0;<textArray.length;i++)
                   textArray[i].setBackground(Color.blue);
                   for(int i=start;<textArray.length;i+=step)
                   textArray[i].setBackground(Color.yellow);
              catch(Exception x)
                   JOptionPane.showMessageDialog(null,"Data Entry Error","Error",JOptionPane.INFORMATION_MESSAGE);
                   arg = "Clear")
                   startTF.setText("");
                   stopTF.setText("");
                   stepTF.setText("");
                   for(int i=0;<textArray.length;i++)
                   textArray[i].setBackground(Color.white);
         }//end actionPerformed
         public static void main(String[]args)
              Checkerboard f = new Checkerboard();
              f.setBounds(50,100,300,300);
              f.setTitle("Checkerboard Array");
              f.setVisible(true);
         }//end main method
    }//end Checkerboard class

    import javax.swing.JOptionPane;
    import java.awt.*;
    import java.awt.event.*;
    public class Checkerboard extends Frame implements ActionListener
         //declare variables
         int start, stop, step;
         Panel boardPanel = new Panel();
              TextArea boardDisplay [] = new TextArea[16];
         Panel buttonPanel = new Panel();
              Button goButton = new Button ("Go");
              Button clearButton = new Button("Clear");
         Panel inputPanel = new Panel();
              Label startLabel = new Label ("Start");
              TextField startField = new TextField();
              Label stopLabel = new Label ("Stop");
              TextField stopField = new TextField();
              Label stepLabel = new Label ("Step");
              TextField stepField = new TextField();
    public Checkerboard()
         this.setLayout(new BorderLayout());
              boardPanel.setLayout(new GridLayout (4, 4, 2, 3));
              inputPanel.setLayout(new FlowLayout());
              buttonPanel.setLayout(new FlowLayout());
              for (int i=0; i<16; i++)
                   boardDisplay = new TextArea(null,3,5,3);
              if (i<16)
                        boardDisplay[i].getText();
                   else
                        boardDisplay[i].setEditable(false);
                        boardDisplay[i].setBackground(Color.white);
                        boardPanel.add(boardDisplay[i]);
    //add components to the button
    buttonPanel.add(goButton);
    //add components to input panel
    inputPanel.add(startField);
    inputPanel.add(stopField);
    inputPanel.add(stepField);
    inputPanel.add(startLabel);
    inputPanel.add(stopLabel);
    inputPanel.add(stepLabel);
    //add panels to frame
    add(buttonPanel, BorderLayout.SOUTH);
    add(inputPanel, BorderLayout.CENTER);
    add(boardPanel, BorderLayout.NORTH);
    goButton.addActionListener(this);
    addWindowListener(new WindowAdapter()
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
         }//end Checkerboard frame
    public void actionPerformed(ActionEvent e)
         String arg = e.getActionCommand();
         try
              if (arg == "GO")
                   start=Integer.parseInt(startTF.getText());
                   stop=Integer.parseInt(stopTF.getText());
                   step=Integer.parseInt(stepTF.getText());
                   for(int i=0;<textArray.length;i++)
                   textArray[i].setBackground(Color.blue);
                   for(int i=start;<textArray.length;i+=step)
                   textArray[i].setBackground(Color.yellow);
              catch(Exception x)
                   JOptionPane.showMessageDialog(null,"Data Entry Error","Error",JOptionPane.INFORMATION_MESSAGE);
                   arg = "Clear")
                   startTF.setText("");
                   stopTF.setText("");
                   stepTF.setText("");
                   for(int i=0;<textArray.length;i++)
                   textArray[i].setBackground(Color.white);
         }//end actionPerformed
         public static void main(String[]args)
              Checkerboard f = new Checkerboard();
              f.setBounds(50,100,300,300);
              f.setTitle("Checkerboard Array");
              f.setVisible(true);
    }//end main method
    }//end Checkerboard class                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

Maybe you are looking for