Could potentially have the longest error message EVER and have no idea how to solve it ....
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
The import java.sql cannot be resolved
The import javax cannot be resolved
Connection cannot be resolved to a type
Statement cannot be resolved to a type
ResultSet cannot be resolved to a type
Implicit super constructor Object() is undefined. Must explicitly invoke another constructor
String cannot be resolved to a type
Class cannot be resolved
Connection cannot be resolved to a type
DriverManager cannot be resolved
Statement cannot be resolved to a type
Connection cannot be resolved to a type
ResultSet cannot be resolved
ResultSet cannot be resolved
Exception cannot be resolved to a type
JOptionPane cannot be resolved
String cannot be resolved to a type
String cannot be resolved to a type
System cannot be resolved
Statement cannot be resolved to a type
ResultSet cannot be resolved to a type
Statement cannot be resolved to a type
ResultSetMetaData cannot be resolved to a type
ResultSet cannot be resolved to a type
Exception cannot be resolved to a type
JOptionPane cannot be resolved
String cannot be resolved to a type
String cannot be resolved to a type
ResultSet cannot be resolved to a type
ResultSet cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
ResultSet cannot be resolved to a type
ResultSet cannot be resolved to a type
System cannot be resolved
ResultSet cannot be resolved to a type
ResultSet cannot be resolved to a type
System cannot be resolved
Exception cannot be resolved to a type
JOptionPane cannot be resolved
String cannot be resolved to a type
String cannot be resolved to a type
System cannot be resolved
Statement cannot be resolved to a type
ResultSet cannot be resolved to a type
Statement cannot be resolved to a type
Exception cannot be resolved to a type
JOptionPane cannot be resolved
ResultSetMetaData cannot be resolved to a type
ResultSet cannot be resolved to a type
System cannot be resolved
String cannot be resolved to a type
String cannot be resolved to a type
System cannot be resolved
Exception cannot be resolved to a type
JOptionPane cannot be resolved
String cannot be resolved to a type
String cannot be resolved to a type
System cannot be resolved
Statement cannot be resolved to a type
ResultSet cannot be resolved to a type
Statement cannot be resolved to a type
Exception cannot be resolved to a type
JOptionPane cannot be resolved
ResultSetMetaData cannot be resolved to a type
ResultSet cannot be resolved to a type
String cannot be resolved to a type
String cannot be resolved to a type
System cannot be resolved
System cannot be resolved
Exception cannot be resolved to a type
JOptionPane cannot be resolved

at QueryFetcher.<init>(QueryFetcher.java:2)
at LController.getData(LController.java:274)
at LController.actionPerformed(LController.java:95)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
at javax.swing.AbstractButton.doClick(AbstractButton.java:337)
at LController.<init>(LController.java:41)
at Login.loginLevel(Login.java:159)
at Login.actionPerformed(Login.java:109)
at javax.swing.JTextField.fireActionPerformed(JTextField.java:492)
at javax.swing.JTextField.postActionEvent(JTextField.java:705)
at javax.swing.JTextField$NotifyAction.actionPerformed(JTextField.java:820)
at javax.swing.SwingUtilities.notifyAction(SwingUtilities.java:1636)
at javax.swing.JComponent.processKeyBinding(JComponent.java:2849)
at javax.swing.JComponent.processKeyBindings(JComponent.java:2884)
at javax.swing.JComponent.processKeyEvent(JComponent.java:2812)
at java.awt.Component.processEvent(Component.java:5815)
at java.awt.Container.processEvent(Container.java:2058)
at java.awt.Component.dispatchEventImpl(Component.java:4410)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.KeyboardFocusManager.redispatchEvent(KeyboardFocusManager.java:1848)
at java.awt.DefaultKeyboardFocusManager.dispatchKeyEvent(DefaultKeyboardFocusManager.java:697)
at java.awt.DefaultKeyboardFocusManager.preDispatchKeyEvent(DefaultKeyboardFocusManager.java:962)
at java.awt.DefaultKeyboardFocusManager.typeAheadAssertions(DefaultKeyboardFocusManager.java:834)
at java.awt.DefaultKeyboardFocusManager.dispatchEvent(DefaultKeyboardFocusManager.java:661)
at java.awt.Component.dispatchEventImpl(Component.java:4282)
at java.awt.Container.dispatchEventImpl(Container.java:2116)
at java.awt.Window.dispatchEventImpl(Window.java:2429)
at java.awt.Component.dispatchEvent(Component.java:4240)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)

any ideas??

i have 9 classes which all compile in bluej but when i run it and after i log in all this messages come up but i dont know where its coming from.

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.text.DecimalFormat;
import java.sql.*;
import java.util.Date;
import java.text.SimpleDateFormat;


public class LController implements ActionListener
{
DecimalFormat df = new DecimalFormat("###.00");
private LibraryGUI libg;
private String user;
private ChPwGUI cpwg;
private NewBookGUI nbg ;
private TakeOutLoanGUI tol;
private QueryFetcher qF;
private Store Storage;
private int selectedId = -1;
String bookname;
String authorf;
String authors;




    public LController(String LLoginName, int level)
    {
        // initialise instance variables
        user = LLoginName;
        nbg= new NewBookGUI(user);
        tol = new TakeOutLoanGUI(user);
        libg = new LibraryGUI(level, user);
        libg.addLibraryGUIActionListeners(this);//register controller as listener to bank GUI
        WindowQuitter wquit = new WindowQuitter();      // create quit object using inner class to close window
        libg.addLibraryWindowListener(wquit);
        if (level < 8) libg.jmiChangeLogin.setEnabled(false);
        if (level < 8) libg.jmiTakeLoan.setEnabled(false);
        libg.jmiViewAllBooks.doClick();
        libg.setVisible(true);


    }
    public void openLogin()
    {
        Login log = new Login(); 
        log.setLocation(100,100);
        log.setSize(350,250);
        log.setVisible(true);  
        System.out.println("New login window.");
    }//end openLogin
    public void openChPwGUI()
    {
        cpwg = new ChPwGUI(user);
        cpwg.addChangePasswordActionListeners(this);
        cpwg.setLocation(30,30);
        cpwg.setSize(350,250);
        cpwg.setVisible(true);  
        System.out.println("New change password window for user: " + user);
    }
    public void openNewBookGUI()
    {
        nbg = new NewBookGUI(user);
        nbg.addNewBookActionListeners(this);
        nbg.setLocation(30,30);
        nbg.setSize(480,220);
        nbg.setVisible(true); 
    }
    public void openTakeOutLoanGUI()
    {
        tol = new TakeOutLoanGUI(user);
        tol.addTakeOutLoanActionListeners(this);
        tol.setLocation(50,50);
        tol.setSize(480,220);
        tol.setVisible(true);
    }


    /**
     *methods
     */



    public void actionPerformed(ActionEvent ae) 
    {
        Object source = ae.getSource();
        //Filters from the "Tool Bar"       
        if (source == libg.jmiViewAllBooks)
        { 
            System.out.println("View All Books");
            String sql="Select * from tblBook";
            getData(sql,"All Books");
            System.out.println(sql);
        }

        if (source == libg.jmiFilterByFAuthor)
        { 
            System.out.println("filter By Author Firstname");
            String Firstname = JOptionPane.showInputDialog(libg,"Firstname: ","Library - Filter by Firstname");
            String sql="SELECT * FROM QryBooks WHERE Firstname LIKE '%" + Firstname + "%'"; 
            System.out.println("Firstname = " + Firstname);
            getData(sql,"All Books matching Firstname containing " + Firstname);     
            System.out.println(sql);
        }

        if (source == libg.jmiFilterBySAuthor)
        { 
            System.out.println("filter By Author Surname");
            String Surname = JOptionPane.showInputDialog(libg,"Surname: ","Library - Filter by surname");
            String sql="SELECT * FROM QryBooks WHERE Surname LIKE '%" + Surname + "%'"; 
            System.out.println("Surname = " + Surname);
            getData(sql,"All books matching Surname containing " + Surname);
        }

        if (source == libg.jmiFilterBySeries)
        { 
            System.out.println("filter By Series Name");
            String SeriesName = JOptionPane.showInputDialog(libg,"Series: ","Library - Filter by Series");
            String sql="SELECT * FROM QryBooks WHERE SeriesName LIKE '%" + SeriesName + "%'"; 
            System.out.println("Series = " + SeriesName);
            getData(sql,"All Series containing " + SeriesName);
        }

        if (source == libg.jmiFilterByTakenOut)
        { 
            System.out.println("filter By Taken Out (1)");
            int TakenOut = 1;
            String sql="SELECT * FROM QryBooks WHERE TakenOut =" + TakenOut; 
            System.out.println("Loans = " + TakenOut);
            getData(sql,"All loans containing " + TakenOut);
        }
//          if(source == libg.jmiFilterByNOL)
//         {
//            System.out.println("filter By Number of Loans");
//            int NOLcompare = 0;
//            String sql ="SELECT * FROM QryBooks WHERE NOL >" + NOLcompare;
//            getData(sql,"All loans >" + NOLcompare);
//         }
        if (source == libg.jmiChangeLogin)
        {
            System.out.println("Edit login button clicked");
            openChPwGUI();           
        }

        if (source == libg.jmiExit)
        { 
            System.out.println("password Quit button clicked");
            System.out.println("logging out. Closing Library.");
            openLogin();     
            libg.dispose();
        }

        if (source == libg.jbtPrint)
        { 
            System.out.println("print button clicked");
            try
            {
                libg.lTable.print();
            }
            catch (java.awt.print.PrinterException pl)
            { //if there is a run-time printing error, print message and trace
                pl.printStackTrace();
                System.out.print("Jtable print FAILED :- error - " + pl.getMessage() );
            }//end of catch block
        }



        if (source == libg.jmiNewBook)
        { 
            System.out.println("New Book Button pressed");
            openNewBookGUI();           
        }

        if (source == libg.jmiTakeLoan)
        {
            System.out.println("Take Out Loan");
            openTakeOutLoanGUI();
        }
        if (source == libg.jmiQuit)
        {
            System.out.println("logging out. Library closed.");
            openLogin();     
            libg.dispose();
        }

        else if (source == tol.jbTakeOut)
       {    bookname = tol.jtfBookName.getText();
           authorf = tol.jtfAuthorFName.getText();
           authors = tol.jtfAuthorSName.getText();
           Store.changeLoanStatus(bookname, authorf, authors);
           Storage.closeConnection();
        }

        else if (cpwg !=null && source == cpwg.jbSubmit)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("password GUI submit button clicked");

            tryNewPassword();
        }
        else if (cpwg !=null && source == cpwg.jbCancel)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("password GUI cancel button clicked");
            cpwg.jpfOPassword.setText("");
            cpwg.jpfN1Password.setText("");
            cpwg.jpfN2Password.setText("");
            cpwg.jpfOPassword.requestFocus();
        }
       else if (cpwg !=null && source ==cpwg.jbQuit)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("password Quit button clicked");     
            cpwg.dispose();
        }
        else if (cpwg !=null && source ==cpwg.jpfOPassword)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("old password text field <enter>");
            cpwg.jpfN1Password.requestFocus();
        }
        else if (cpwg !=null && source ==cpwg.jpfN1Password)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("new password 1 text field <enter>");
            cpwg.jpfN2Password.requestFocus();
        }
        else if (cpwg !=null && source ==cpwg.jpfN2Password)
        {
            System.out.println("cpwg = " + cpwg);
            System.out.println("new password 2 text field <enter>");
            tryNewPassword();
        }
        else if (source == nbg.jbSubmit && (nbg.bookname.equals("") || nbg.authorf.equals("") || nbg.authors.equals("") || nbg.series.equals("")))
        {
            JOptionPane.showMessageDialog(null,  " Error, Fields have been left Empty! "," ERROR! ", JOptionPane.ERROR_MESSAGE); 
        }



        else if (nbg !=null && source ==nbg.jbSubmit)
        {
            System.out.println("Submit Button Clicked.");
            String bookName = NewBookGUI.jtfBookName.getText();
            String authorFName = NewBookGUI.jtfAuthorFName.getText();
            String authorSName = NewBookGUI.jtfAuthorSName.getText();
            int SeriesNo = Integer.parseInt(NewBookGUI.jtfSeriesNumber.getText());
            String SeriesNa = NewBookGUI.jtfSeriesName.getText();
            Store storage = new Store();
            Store.newBook (bookName, authorFName, authorSName, SeriesNo, SeriesNa);
            storage.closeConnection();
            nbg.dispose();
            System.out.println("View All Books");
            String sql="Select * from tblBook";
            getData(sql,"All Books");
            System.out.println(sql);
        }
        else if (source == nbg.jbCancel)
        {
            nbg.dispose();
        }

    }



    public void getData(String sql, String message) //uses queryfetcher
    {
        int noOfColumns = 0;
        QueryFetcher allBooks = new QueryFetcher("Library.mdb");
        String allValues[] [], colNames[], colTypes[];
        allValues = allBooks.getFilteredBooks(sql); 
        System.out.println("datavalues = " + allValues);
        colNames = allBooks.getLibraryColumnNames(sql);
        colTypes  = allBooks.getLibraryColumnTypes(sql);
        System.out.println("colNames = " + colNames + "colTypes = " + colTypes);
        showBooks(allValues, colNames, colTypes, message);

        }


    public void showBooks(String data[] [] , String cols[], String types[], String title) 
    {
        //takes arrays with data, column headings and data types and displays in JTable
        int c=cols.length;      //c = no of fields = length of colls array
        System.out.println("c = " + c);
        int r = data.length;    //r = no of rows
        System.out.println("r = " + r);
        int[] w = new int[c];   //width of each column
        System.out.println("w = " + w);
        int tw = 0;//total width of cols
        System.out.println("tw = " + tw);
        for  (int col=0;col<c;col++)    //loop through cols
                {
            w[col] = 5;
            for (int row=0;row<r;row++)
                    {   
                //add in £ symbol to currency values
                if (types[col].equals("CURRENCY")&& data[row][col]!=null )
                {
                    double d = Double.parseDouble(data[row][col]);     
                    if (d >=0)data[row][col] = "  £" + df.format(d);
                    else data[row][col] = "- £" + df.format(-d); 
                        }//end if
                //find maximum number of characters in each column of data
                if (data[row][col]!=null && w[col]<data[row][col].length()) w[col] = data[row][col].length();
                    }//end inner row for loop
            System.out.println("w["+col+"] = " + w[col]);
                    tw = tw + w[col];       //add size of each column to get total width
                }//end outer column for loop

            if (libg.scrollPane != null)libg.jpAll.remove(libg.scrollPane);     //remove scroll pane if exists
            libg.lTable = new JTable( data, cols );//create new JTable
            Color colour = new Color(91,209,234);
            libg.lTable.setBackground(colour);
            libg.scrollPane = new JScrollPane( libg.lTable );                 //... scrollpane
            libg.lTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);        
            libg.lsm = libg.lTable.getSelectionModel();                       //... list selection model
            libg.jpAll.add( libg.scrollPane, BorderLayout.CENTER);
            libg.jpAll.setBackground(Color.BLACK); 
            //set preferred column widths of JTable to match data widths in array w (with minimum of about 10 'pixels')
            for(int i=0;i<c;i++)
            {
                libg.lTable.getColumnModel().getColumn(i).setPreferredWidth(w[i]*10+15);
            }
            if (tw*10+c*15 < 1250)libg.setPreferredSize(new Dimension(tw*10+c*15,320));
            else libg.setPreferredSize(new Dimension(1250,320)); 
            libg.pack();
        }




        private void tryNewPassword()
        {
            String fpw = Store.charArrayToString(cpwg.jpfN1Password.getPassword());
            String spw = Store.charArrayToString(cpwg.jpfN2Password.getPassword());
            String opw = Store.charArrayToString(cpwg.jpfOPassword.getPassword());
            System.out.println("fpw = " + fpw + "and spw = " + spw + " and opw = " + opw);
            if(verifyPassword(fpw,spw)) //check new passwords match
            {
                System.out.println("new password verified");
                Store st = new Store();                      // create connection object
                int level = st.SQLfindLogin(user, opw);     //-1 login failed otherwise returns security level
                System.out.println("verified password level = " + level);
                if (level >0)       //old password is valid
                {
                    System.out.println("old password correct - changing password ...");
                    st.changePassword(user, fpw);
                    cpwg.jtfFeedback.setText("password changed");
                    JOptionPane.showMessageDialog(cpwg,"Change successful. Close window.","Password change",JOptionPane.INFORMATION_MESSAGE);
                    cpwg.dispose();
                }
                else System.out.println("password error - no change made");
                st.closeConnection();                  // close connection
            }
            else 
            {
                System.out.println("password needs to match and be valid - change FAILED");   
                cpwg.jtfFeedback.setText("change FAILED - try again");
            }
        }   

        private boolean verifyPassword(String p1, String p2)
        {
            if (p1.length() > 2 && p1.equals(p2)) return true;
            else return false;
        }

        //inner class to open login window as this window closes
        class WindowQuitter extends WindowAdapter
        {
            public void windowClosing( WindowEvent we )
            {

                System.out.println("Logged out...");
                //create login screen
                openLogin();
                libg.dispose();           //and quit   
            }
        }//end WindowQuitter class

    }//end of class

thats my main class.

Edited 3 Years Ago by Dani: Formatting fixed

Code tags please. You can edit your post and add them.

[code=JAVA] // paste code here

[/code]

So it compiles fine and those are run-time errors?

Its all done in Bluej / java
the whole thing compiles together..... and login appears and when i log in it says its fine but just comes up with all this error message :(

import java.sql.*;
import javax.swing.*;

public class TestClass
{
    public static void main (String args[])
    {
        System.out.println ("Hello World.");
    }
}

Does this program compile/run for you?

>thats my main class.
I think you mean that's the main class you copied from someone else and can't get to run.

i tried the testClass which you suggested and it works and compiles but i didnt copy the code frrom else where as its been working previously up to my last ammendment.

This article has been dead for over six months. Start a new discussion instead.