Help Finding Compiler error solution please

When I type in Javac at C prompt to this code I receive the following errors
Code:
public class PayrollExecute
// main method
public static void main( String args[] )
// Display welcome message
Payroll myPayroll = new Payroll( "Payroll " );
mypayroll.displayMessage(); // display first message
myPayroll.determineWeeklyRate(); // find weekly rate
} // end main method
} // end class
Error:
C:\>Javac Payroll.java
Payroll.java:1: class PayrollExecute is public, should be declared in a file named PayrollExecute.java
public class PayrollExecute
^
.\Payroll.java:1: class PayrollExecute is public, should be declared in a file named PayrollExecute.java
public class PayrollExecute
^
Payroll.java:13: cannot access Payroll
bad class file: .\Payroll.java
file does not contain class Payroll
Please remove or make sure it appears in the correct subdirectory of the classp
th.
Payroll myPayroll = new Payroll( "Payroll " );
^
3 errors
C:\>

The name of the file you are compiling needs to be PayrollExecute.java OR remove the "public" before public class PayrollExecute.
Either choice should do the trick.

Similar Messages

  • Warning: View altered with compilation errors. : Please help.

    Hi All,
    Found few views invalid, tried to compile them, but got the following error. It looks like synonyms are calling each other.
    Please help to compile the view.
    =======================
    SQL> alter view APPS.PER_ADDRESSES_AV12 compile;
    Warning: View altered with compilation errors.
    Checked error:
    SQL> SHOW errors VIEW APPS.PER_ADDRESSES_AV12;
    Errors for VIEW APPS.PER_ADDRESSES_AV12:
    LINE/COL ERROR
    0/0 ORA-01775: looping chain of synonyms
    Extracted DDL:
    ==========
    CREATE OR REPLACE FORCE VIEW "APPS"."PER_ADDRESSES_AV12" ("ROW_KEY", "ADDRESS_
    ID", "TOWN_OR_CITY") AS
    SELECT ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES_A WHERE TOWN_OR_CI
    TY IS NOT NULL OR SUBSTR(AUDIT_TRUE_NULLS,12,1)='Y' UNION ALL SELECT 99991231235
    9591111122222 ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES
    Checked synonyms for the base table:
    =======================
    OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
    PUBLIC PER_ADDRESSES HR PER_ADDRESSES
    APPS PER_ADDRESSES HR PER_ADDRESSES
    XXHRC PER_ADDRESSES APPS PER_ADDRESSES
    Edited by: 784786 on Dec 22, 2011 7:27 AM

    784786 wrote:
    Found few views invalid, tried to compile them, but got the following error. It looks like synonyms are calling each other.
    Please help to compile the view.
    SQL> alter view APPS.PER_ADDRESSES_AV12 compile;
    Warning: View altered with compilation errors.
    SQL> SHOW errors VIEW APPS.PER_ADDRESSES_AV12;
    Errors for VIEW APPS.PER_ADDRESSES_AV12:
    LINE/COL ERROR
    0/0 ORA-01775: looping chain of synonyms
    CREATE OR REPLACE FORCE VIEW "APPS"."PER_ADDRESSES_AV12" ("ROW_KEY", "ADDRESS_
    ID", "TOWN_OR_CITY") AS
    SELECT ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES_A WHERE TOWN_OR_CI
    TY IS NOT NULL OR SUBSTR(AUDIT_TRUE_NULLS,12,1)='Y' UNION ALL SELECT 99991231235
    9591111122222 ROW_KEY, ADDRESS_ID, TOWN_OR_CITY FROM PER_ADDRESSES
    OWNER SYNONYM_NAME TABLE_OWNER TABLE_NAME
    PUBLIC PER_ADDRESSES HR PER_ADDRESSES
    APPS PER_ADDRESSES HR PER_ADDRESSES
    XXHRC PER_ADDRESSES APPS PER_ADDRESSESso break the chain by dropping one or of them

  • Please help with compiling error

    Hello, I am currently taking a class in Java Programming and need help with an error. I am working on a Mortgage Calculator and when I compile the code I get this error. I have no idea how to fix this. Can anyone help? Thank you.
    '{' expected public class MortgageCalculator
    1 error
    Tool completed with exit code 1
    Here is my code
    import java.io.*;//*java input output
    import java.util.Date;//Date Utility
    import java.util.Formatter;//format Utility
    import java.text.NumberFormat;//*format numbers
    //class MortgageCalculator
    public class MortgageCalculator
    public static void main(String[]args);{
    Date currentDate=newDate();
    DecimalFormat decimalPlaces=newDecimalFormat("0.00");
    //declare Variables
    final double principalBalance=200000;//*$200,000 Loan
    final double monthlyInterest=.06;//*6% interest rate
    final double Term=12*30;//*monthly interest rate
    final double monthlyInterest=((principalBalance*(monthlyInterest/12))/(1-Math.pow(1+(monthlyInterest/12))-(Term)));
    //Display Output
    System.out.println("\t\t" + currentDate);
    System.out.println("\t\tLoan Amount" + principalBalance);
    System.out.println("\t\tInterest Rate" + monthlyInterest);
    System.out.println("\t\tTerm of Loan" + Term);
    System.out.println("\t\tThe Payment will be:" + monthlyInterest);
    System.out.println(decimalPlaces.format(mothlyInterest));
    }

    You need to enclose your class body in { }. You're missing at least one of them

  • Compilation error..Please Help

    I had recently installed the jdk1.3 (Win ME version). I have no problem with my path variable although I doubt the classpath variable setting, which is given as follows.
    D:\java\p_java>set classpath=%classpath%;D:\java\jdk1.3.1_02\jre\lib;D:\java\jdk1.3.1_02\lib\
    where p_java is my java programs directory
    jdk1.3.1_02 is the Java 2 SDK directory.
    Problem
    Whenever a java program is compiled, the very same error of "Access Denied" is displayed. This can be seen in the foll. examples.
    Example 1:
    D:\java\p_java>javac Statik.java
    )Statik.java:3: error while writing Statik: Statik.class (Access is denied
    class Statik{
    ^
    1 error
    Example 2:
    D:\java\p_java>javac Stack.java
    )Stack.java:1: error while writing Stack: Stack.class (Access is denied
    public class Stack
    ^
    1 error
    Request
    Could anyone tell me whether the classpath variable has to be set explicitly as in 1.2 version or leave it alone.( in case I don't have any user-classes.
    I would be very obliged if u could suggest a possible remedy for this compilation error.
    Awaiting a solution,
    Thankz,
    Preeti

    This looks like a file creation problem. The only reason I can think why this might occur, given the information you have supplied, is that the files Statik.class and Stack.class already exist, and are read-only. Have you perhaps copied this example from a CD-ROM? If so, select all the files, right-click, choose properties and clear the read-only checkbox.
    If this isn't the case, I'm afraid I can't think of anything else.
    Robin

  • Help! Compiling error

    Hello guys!
    I',m having this bizare compiling error in the following code:
    Stirng test = "Test ; test ; test";
    String[] tests = test.split(";");
    System.out.printLine(tests.lengh());First off it highlights tests.length() and says in cannot find symbol, second When I compile it anyways it says ERROR, incompatible source code.... Thanks alot for your help
    best regards
    Michel

    mbehlok wrote:
    Hello guys!
    I',m having this bizare compiling error in the following code:
    Stirng test = "Test ; test ; test";
    String[] tests = test.split(";");
    System.out.printLine(tests.lengh());First off it highlights tests.length() and says in cannot find symbol, second When I compile it anyways it says ERROR, incompatible source code.... Thanks alot for your help
    best regards
    Michel
    String test = "Test ; test ; test";
      String[] tests = test.split(";");
      System.out.println(tests.length);
    In Java, there is no length() method i Array Class. It is a property. So, use like this.....
    Edited by:Mrityunjay Kumar on Oct 31, 2009 4:15 PM

  • Help with compilation error

    Hello
    I have a problem with my jsp developement. When i create a jsp (with no beans) i test it and it runs fine (not good but fine), then when I test it with multiple users at time, it generate a jsp compilation error ie. "missing term }" and I can not figure out why it is getting that error, it has been compilated before! so it should not generate a compilation error, becouse i'm not editing the jsp source. I think that every time the jsp is requested the virtual machine is re-compiling it, but is only what i thing and i don't know why... can any body help me? please.
    I apologize for my bad english
    Thank you for your time reading this.

    Sorry becouse i can't be more espesific with the error that i get, that error is complete apears in a complete randomic way, I mean taht it apears when nerver is expected or doesn't apear when is expected, only thing that i got of that error is that the compiler some time says that are mising semi-colon (;), some time says that are mising quotation marks (") or are mising }, the error is no the same allways no mater the situation, I can run the jsp in my pc but the error doesn't apear, thats very strange becouse the compilation error apear after the jsp was executed with no errors.
    this is my jsp:
    <%@ page import="java.util.Calendar,java.text.SimpleDateFormat,java.util.Date,java.util.Stack,java.util.Enumeration, java.util.Hashtable,java.sql.*, java.util.Vector" %>
    <%@ include file="../incs/dbpool_inc.jsp" %>
    <%@ include file="funciones.jsp"%><html>
    <head>
    <title>Resolver preguntas</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <link href="../css/0001.css" rel="stylesheet" type="text/css">
    </head>
    <body>
    <% //to get user data from the session.
         String userid = session.getAttribute("idu") != null ? (String)session.getAttribute("idu") : "";
         String asign = session.getAttribute("idHomeAssignatura") != null ? (String)session.getAttribute("idHomeAssignatura"): "";
         String idcuest = session.getAttribute("idcuest") != null ? (String)session.getAttribute("idcuest") : "";
         String secuenc = session.getAttribute("secuenc") != null ? (String)session.getAttribute("secuenc") : "";     
         String secuens = request.getParameter("secuens") != null ? request.getParameter("secuens") : "0";
         //to know if it's aloww to save cahnges in the database
         boolean guardar = request.getParameter("guardar") != null ? (request.getParameter("guardar")).equals("si")? true: false :false;
         if(userid.equals("")|| asign.equals("")){//if 1          
              out.println("</head><body><font face=\"Arial\" size=\"2\" color=\"#000000\"><b>El tiempo de conexi&oacute;n ha expirado. Para ingresar de nuevo al sistema haga click aqu&iacute;.</b></font></body></html>");
         }//fin if 1
         else{//else de if 1          
              try{// try 1
                   Connection conn = dbpool.getConnection();
                   Statement stmtt = conn.createStatement();
                   Statement stmtmod = conn.createStatement();
                   Statement stmtresp = conn.createStatement();
                   ResultSet rsmodul = stmtmod.executeQuery("select id_modulo from eit_cuestxmat where id_cuestionario="+idcuest);
                   String modulo = rsmodul.next()? rsmodul.getString("id_modulo"): "";
                   rsmodul.close();
                   stmtmod.close();
                   int secuencia1 = Integer.parseInt(secuens);
                   int secuencia2 = Integer.parseInt(secuenc)+1;
                   secuenc = (secuencia1 == secuencia2)? String.valueOf((Integer.parseInt(secuenc)+1)): secuenc;
                   session.setAttribute("secuenc", secuenc);               
                   if(esAlumno(userid, stmtt, asign)){//if 2
                   if(guardar){//if 2.0
                             String idpreg1 = request.getParameter("idpregunta") != null ? request.getParameter("idpregunta") : "";
                             ResultSet rstipop = stmtt.executeQuery("select tipo from eit_pregunta where id_pregunta="+idpreg1);                         
                             String tipop1 = rstipop.next()? rstipop.getString("tipo") : "";
                             rstipop.close();
                             String respuesta = "N/A", correspondencia ="";                         
                             String restado="n";
                             String rcorrecta = "n";
                             if(tipop1.equals("selec")){
                                  correspondencia = request.getParameter("rprevia") != null? request.getParameter("rprevia") : "-1";
                                  ResultSet rscorrecta = stmtt.executeQuery("select escorrecta from eit_opciones where id_pregunta="+
                                                           idpreg1+" and id_opcion="+correspondencia+" and escorrecta like 's'");
                                  if(rscorrecta.next()){
                                       rcorrecta = "s";
                                  rscorrecta.close();
                             else{
                                  if(tipop1.equals("empar")){
                                       ResultSet rsempar = stmtt.executeQuery("select escorrecta from eit_opciones where id_pregunta="+
                                                                idpreg1+ "order by orden");
                                       int corres = 0;
                                       int correctas = 0;
                                       while(rsempar.next()){                                   
                                                 String resp = request.getParameter("selopc"+String.valueOf(corres+1)) != null? request.getParameter("selopc"+String.valueOf(corres+1)) : "";
                                                 correspondencia=correspondencia+((corres == 0)? "":",")+resp;
                                                 correctas = correctas + (resp.equals(rsempar.getString("escorrecta"))? 1 : 0);
                                                 corres++;
                                       rcorrecta = String.valueOf(correctas);
                                       rsempar.close();
                                  else{
                                       if(tipop1.equals("complet")){
                                            ResultSet rscomplet= stmtt.executeQuery("select correspondencia from eit_opciones where id_pregunta="+idpreg1);
                                            String complet = rscomplet.next()? rscomplet.getString("correspondencia"):"";
                                            rscomplet.close();
                                            String complet1 = "";
                                            int idxcar = complet.indexOf("$");
                                            respuesta = request.getParameter("comp0") != null ? request.getParameter("comp0") : "";
                                            correspondencia = request.getParameter("comp1") != null ? request.getParameter("comp1") : "";
                                            int corrc =0;
                                            if(idxcar>=0){
                                                 complet1 = complet.substring((idxcar+1),complet.length());
                                                 complet = complet.substring(0, idxcar);
                                                 corrc = (respuesta.equalsIgnoreCase(complet))? 1 : 0;
                                                 corrc = (correspondencia.equalsIgnoreCase(complet1))? (corrc+1) : corrc;
                                                 rcorrecta = (corrc==2)? "s": (corrc==1)? "m": "n";
                                            }else{
                                                 corrc=(respuesta.equalsIgnoreCase(complet))? 1 : 0;
                                                 rcorrecta = (corrc==1)? "s": "n";
                                       else{
                                            if(tipop1.equals("abierta")){
                                                 respuesta = request.getParameter("respuesta") != null? request.getParameter("respuesta") : "";
                             String guardarResp = "insert into eit_respuesta(id_pregunta, id_cuestionario, id_materia, id_modulo"+
                                                      ", respuesta, correspondencia, rcorrecta, restado, sec_pregunta, codest)"+
                                                      " values ("+idpreg1+", "+idcuest+", '"+asign+"', "+modulo+", '"+respuesta+"', '"+correspondencia+"', '"+rcorrecta+"', '"+restado+"', "+
                                                      String.valueOf((Integer.parseInt(secuenc)-1))+", "+userid+")";
                             String sqlexistencia = "select id_pregunta from eit_respuesta where codest ="+userid+" and id_cuestionario="+idcuest+" and id_materia="+
                                                           asign+" and id_modulo="+modulo+" and id_pregunta="+idpreg1;                         
                             boolean existeResp = (stmtt.executeQuery(sqlexistencia)).next();
                             String editarResp = "update eit_respuesta set respuesta='"+respuesta+"', correspondencia='"+correspondencia+"', "+
                                                      "rcorrecta='"+rcorrecta+"', restado='"+restado+
                                                      "' where codest ="+userid+" and id_cuestionario="+idcuest+" and id_materia like '"+
                                                      asign+"' and id_modulo="+modulo+" and id_pregunta="+idpreg1;
                             //if the page is editing execute string editarResp else execute string guardarResp
                             stmtt.executeUpdate(existeResp? editarResp:guardarResp);
                        String sqlbpu="select p.enunciado, p.tipo, p.titulo, p.id_pregunta from eit_pregunta p, eit_prexcuest pxc where pxc.id_cuestionario="+idcuest+" and pxc.id_pregunta = p.id_pregunta and pxc.secuenc= "+String.valueOf(secuenc);//bupu: buscar pregunta cuestionario
                        //System.out.println("resolvpreg.jsp "+sqlbpu);
                        ResultSet rsbpu = stmtt.executeQuery(sqlbpu);
                        if(rsbpu.next()){ // if 2.1
                             String enunciado = rsbpu.getString("enunciado");
                             String tipo = rsbpu.getString("tipo");
                             String titulo = rsbpu.getString("titulo");
                             String idpreg = rsbpu.getString("id_pregunta");
    %>
    <h1 align="center"><font color="#0033CC" face="Arial, Helvetica, sans-serif"><%=titulo%></font></h1><br>
    <p align="left"><font face="Arial, Helvetica, sans-serif">
    <strong>Enunciado:</strong> <%=enunciado%>. </font><br>
    <%
         String sqlrespuesta = "select respuesta, correspondencia from eit_respuesta where id_pregunta="+idpreg+
    " and id_cuestionario = "+idcuest+" and id_materia like '"+asign+"' and id_modulo="+modulo+" and codest= "+userid;     
         ResultSet rsrespuesta = stmtresp.executeQuery(sqlrespuesta);     
         String sqlopcs= "select opcion, escorrecta, correspondencia, orden from eit_opciones where id_pregunta ="+idpreg+"order by orden";
         ResultSet rsops = stmtt.executeQuery(sqlopcs);          
    %>
    <%String letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
         Vector opciones = new Vector();
         Object obj[] = new Object[4];
         while(rsops.next()){
              obj[0] = rsops.getString("opcion");
              obj[1] = "";
              obj[2] = rsops.getString("correspondencia");
              obj[3] = rsops.getString("orden");
              opciones.addElement(obj.clone());
         rsops.close();
    %>
    <form action="resolverpreg.jsp" method="post" name="Correspondencias">
    <%
         String respEmpar = "";
         String respuestap="";
         String respcorres[] = {"",""};
         if(rsrespuesta.next()){     
              respuestap = rsrespuesta.getString("respuesta");
              respEmpar = rsrespuesta.getString("correspondencia");
              respcorres[0]= respuestap;
              respcorres[1]= respEmpar;
         rsrespuesta.close();
         if (tipo.equals("empar")){
    %>
    <%@ include file="resolvempar.jsp"%>
    <%}//fin if tipoPreg = 'emapar'
         else{
         if(tipo.equals("selec")){
    %> <%@ include file="reslovselec.jsp"%>
         <%}//fin if tipopreg = 'select'
         else{
              if(tipo.equals("complet")){%>
              <%@include file="resolvcomplet.jsp"%>
         <%}//fin if tipopreg='complet'
         else{
              if(tipo.equals("abierta")){%>
              <%@include file="resolvabierta.html"%>
              <%}//fin if tipopreg='abierta'
              else{%>
                   <span class="titolForum">Error: no se ingres&oacute; ning&uacute;n tipo de pregunta
                   o se est� accediendo en forma err&oacute;nea a este sitio.</span>
              <%}//fin else de tipopregunta = 'abierta'%>          
         <%}//fin else tipopreg='complet'%>                    
         <%}// fin else de tipopreg = 'select'%>     
    <%}//fin else de tipoPreg = 'emapar'%>
    <br>
    <input name="idpregunta" type="hidden" value="<%=idpreg%>">
    <input name="guardar" type="hidden" value="si">
    <input name="secuens" type="hidden" value="<%=(1+(Integer.parseInt(secuenc)))%>">
    <input type="submit" name="continuar" value="Continuar">
    </form>
    <%                    rsbpu.close();
                        }//fin 2.1                    
                        else{%>
    Ha terminado de realizar la prueba<br>
    <a href="elejCuestion.jsp">Continuar</a>
    <%}
                   }// fin if 2
                   stmtt.close();
                   stmtresp.close();
                   conn.close();
              }// fin try 1
              catch(Exception expt){
                   out.println("Error: "+expt);
         }//fin eles de if 1
    %>
    </body>
    </html>

  • Need help determining compiling error

    Good morning,
    I need help finding the cause of a compiling error I receive. I have reviewed my code numerous times without any luck. I hope you guys might see something I am not! The entire file exceeds the limit I can post, so I am attaching it in 2 posts. Sorry for the inconvenience. The error and my code are posted below. Thank you for your help!
    C:\StockTrackerDB.java:382: cannot find symbol
    symbol : method add(java.lang.Boolean)
    location: class java.util.ArrayList<java.lang.String>
                   aList.add(new Boolean(rs.getBoolean("admin")));
    ^
    1 error
    Tool completed with exit code 1
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    public class StockTrackerDB
         private Connection con = null;
         //Constructor; makes database connection
         public StockTrackerDB() throws ClassNotFoundException,SQLException
              if(con == null)
                   String url = "jdbc:odbc:StockTracker";
                   try
                        Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
                   catch(ClassNotFoundException ex)
                        throw new ClassNotFoundException(ex.getMessage() +
                                    "\nCannot locate sun.jdbc.odbc.JdbcOdbcDriver");
                   try
                        con = DriverManager.getConnection(url);
                   catch(SQLException ex)
                        throw new SQLException(ex.getMessage()+
                                    "\nCannot open database connection for "+url);
         // Close makes database connection; null reference to connection
         public void close() throws SQLException,IOException,ClassNotFoundException
              con.close();
              con = null;
         // Method to serialize object to byte array
         private byte[] serializeObj(Object obj) throws IOException
              ByteArrayOutputStream baOStream = new ByteArrayOutputStream();
              ObjectOutputStream objOStream = new ObjectOutputStream(baOStream);
              objOStream.writeObject(obj); // object must be Serializable
              objOStream.flush();
              objOStream.close();
              return baOStream.toByteArray(); // returns stream as byte array
         // Method to deserialize bytes from a byte array into an object
         private Object deserializeObj(byte[] buf) throws IOException, ClassNotFoundException
              Object obj = null;
              if(buf != null)
                   ObjectInputStream objIStream = new ObjectInputStream(new ByteArrayInputStream(buf));
                   obj = objIStream.readObject(); //IOException, ClassNotFoundException
              return obj;
         // Methods for adding a record to a table
         // add to the Stocks Table
         public void addStock(String stockSymbol, String stockDesc) throws SQLException, IOException, ClassNotFoundException
              Statement stmt = con.createStatement();
              stmt.executeUpdate("INSERT INTO Stocks VALUES ('"
                                    +stockSymbol+"'"
                                    +",'"+stockDesc+"')");
              stmt.close();
         // add to the Users table
         public boolean addUser(User user) throws SQLException,IOException,ClassNotFoundException
              boolean result = false;
              String dbUserID;
              String dbLastName;
              String dbFirstName;
              Password dbPswd;
              boolean isAdmin;
              dbUserID = user.getUserID();
              if(getUser(dbUserID) == null)
                   dbLastName = user.getLastName();
                   dbFirstName = user.getFirstName();
                   Password pswd = user.getPassword();
                   isAdmin = user.isAdmin();
                   PreparedStatement pStmt = con.prepareStatement("INSERT INTO Users VALUES (?,?,?,?,?)");
                   pStmt.setString(1, dbUserID);
                   pStmt.setString(2, dbLastName);
                   pStmt.setString(3, dbFirstName);
                   pStmt.setBytes(4, serializeObj(pswd));
                   pStmt.setBoolean(5, isAdmin);
                   pStmt.executeUpdate();
                   pStmt.close();
                   result = true;
              else
                   throw new IOException("User exists - cannot add.");
              return result;
         // add to the UserStocks table
         public void addUserStocks(String userID, String stockSymbol)
                        throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
              stmt.executeUpdate("INSERT INTO UserStocks VALUES ('"
                                    +userID+"'"
                                    +",'"+stockSymbol+"')");
              stmt.close();
         // Methods for updating a record in a table
         // updating the Users table
         public boolean updUser(User user) throws SQLException, IOException, ClassNotFoundException
              boolean result = false;
              String dbUserID;
              String dbLastName;
              String dbFirstName;
              Password dbPswd;
              boolean isAdmin;
              dbUserID = user.getUserID();
              if(getUser(dbUserID) != null)
                   dbLastName = user.getLastName();
                   dbFirstName = user.getFirstName();
                   Password pswd = user.getPassword();
                   isAdmin = user.isAdmin();
                   PreparedStatement pStmt = con.prepareStatement("UPDATE Users SET lastName = ?," + " firstName = ?, pswd = ?, admin = ? WHERE userID = ?");
                   pStmt.setString(1, dbLastName);
                   pStmt.setString(2, dbFirstName);
                   pStmt.setBytes(3, serializeObj(pswd));
                   pStmt.setBoolean(4, isAdmin);
                   pStmt.setString(5, dbUserID);
                   pStmt.executeUpdate();
                   pStmt.close();
                   result = true;
              else
                   throw new IOException("User does not exist - cannot update.");
              return result;
         }

         // Methods for deleting a record from a table
         // delete a record from the Stocks table
         private void delStock(String stockSymbol) throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
              stmt.executeUpdate("DELETE FROM Stocks WHERE "
                                    +"symbol = '"+stockSymbol+"'");
              stmt.close();
         // delete a record from the Users table
         public void delUser(User user) throws SQLException,IOException,ClassNotFoundException
              String dbUserID;
              String stockSymbol;
              Statement stmt = con.createStatement();
              try
                   con.setAutoCommit(false);
                   dbUserID = user.getUserID();
                   if(getUser(dbUserID) != null) // verify user exists in database
                        ResultSet rs1 = stmt.executeQuery("SELECT userID, symbol "
                                              +"FROM UserStocks WHERE userID = '"+dbUserID+"'");
                        while(rs1.next())
                             try
                                  stockSymbol = rs1.getString("symbol");
                                  delUserStocks(dbUserID, stockSymbol);
                             catch(SQLException ex)
                                  throw new SQLException("Deletion of user stock holding failed: " +ex.getMessage());
                        } // end of loop thru UserStocks
                        try
                        {  // holdings deleted, now delete user
                             stmt.executeUpdate("DELETE FROM Users WHERE "
                                              +"userID = '"+dbUserID+"'");
                        catch(SQLException ex)
                             throw new SQLException("User deletion failed: "+ex.getMessage());
                   else
                        throw new IOException("User not found in database - cannot delete.");
                   try
                        con.commit();
                   catch(SQLException ex)
                        throw new SQLException("Transaction commit failed: "+ex.getMessage());
              catch (SQLException ex)
                   try
                        con.rollback();
                   catch (SQLException sqx)
                        throw new SQLException("Transaction failed then rollback failed: " +sqx.getMessage());
                   // Transaction failed, was rolled back
                   throw new SQLException("Transaction failed; was rolled back: " +ex.getMessage());
              stmt.close();
         // delete a record from the UserStocks table
         public void delUserStocks(String userID, String stockSymbol) throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
              ResultSet rs;
              stmt.executeUpdate("DELETE FROM UserStocks WHERE "
                                    +"userID = '"+userID+"'"
                                    +"AND symbol = '"+stockSymbol+"'");
              rs = stmt.executeQuery("SELECT symbol FROM UserStocks "
                                         +"WHERE symbol = '"+stockSymbol+"'");
              if(!rs.next()) // no users have this stock
                   delStock(stockSymbol);
              stmt.close();
         // Methods for listing record data from a table
         // Ordered by:
         //          methods that obtain individual field(s),
         //          methods that obtain a complete record, and
         //          methods that obtain multiple records
         // Methods to access one or more individual fields
         // get a stock description from the Stocks table
         public String getStockDesc(String stockSymbol) throws SQLException, IOException, ClassNotFoundException
              Statement stmt = con.createStatement();
              String stockDesc = null;
              ResultSet rs = stmt.executeQuery("SELECT symbol, name FROM Stocks "
                                                      +"WHERE symbol = '"+stockSymbol+"'");
              if(rs.next())
                   stockDesc = rs.getString("name");
              rs.close();
              stmt.close();
              return stockDesc;
         // Methods to access a complete record
         // get User data from the Users table
         public User getUser(String userID) throws SQLException,IOException,ClassNotFoundException
              Statement stmt = con.createStatement();
              String dbUserID;
              String dbLastName;
              String dbFirstName;
              Password dbPswd;
              boolean isAdmin;
              byte[] buf = null;
              User user = null;
              ResultSet rs = stmt.executeQuery("SELECT * FROM Users WHERE userID = '" +userID+"'");
              if(rs.next())
                   dbUserID = rs.getString("userID");
                   dbLastName = rs.getString("lastName");
                   dbFirstName = rs.getString("firstName");
                   // Do NOT use with JDK 1.2.2 using JDBC-ODBC bridge as
                   // SQL NULL data value is not handled correctly.
                   buf = rs.getBytes("pswd");
                   dbPswd=(Password)deserializeObj(buf);
                   isAdmin = rs.getBoolean("admin");
                   user = new User(dbUserID,dbFirstName,dbLastName,dbPswd,isAdmin);
              rs.close();
              stmt.close();
              return user; // User object created for userID
         // Methods to access a list of records
         // get a list of selected fields for all records from the Users Table
         public ArrayList listUsers() throws SQLException,IOException,ClassNotFoundException
              ArrayList<String> aList = new ArrayList<String>();
              Statement stmt = con.createStatement();
              ResultSet rs = stmt.executeQuery("SELECT userID, firstName, lastName, admin "
                                                 +"FROM Users ORDER BY userID");
              while(rs.next())
                   aList.add(rs.getString("userID"));
                   aList.add(rs.getString("firstName"));
                   aList.add(rs.getString("lastName"));
                   aList.add(new Boolean(rs.getBoolean("admin")));
              rs.close();
              stmt.close();
              return aList;
         // get all fields in all records for a given user from the UserStocks table
         public ArrayList listUserStocks(String userID) throws SQLException, IOException, ClassNotFoundException
              ArrayList<String> aList = new ArrayList<String>();
              Statement stmt = con.createStatement();
              ResultSet rs = stmt.executeQuery("SELECT * FROM UserStocks "
                                                      +"WHERE userID = '"+userID+"' ORDER BY symbol");
              while(rs.next())
                   aList.add(rs.getString("symbol"));
              rs.close();
              stmt.close();
              return aList;
    }

  • HT5624 Please help find the IMEI number Please?  My Iphone was stolen  AIS network  (Thailand)

    Please help find the IMEI number
    By email:
    Please?
    My Iphone was stolen
    Call
    AIS network
    (Thailand)
    thank you very much
    <Personal Information Edited by Host>

    http://support.apple.com/kb/HT1267
    Regards.

  • Help with compiling error

    Okay, so I've been making a cash register app, and the thing isn't compiling for me. I keep looking over this and I'm not sure why it isn't working, so I was hoping someone could point out what I've done wrong here.
    public class Receipt
            public static void main(String[] args) throws IOException
                    int q;
                    RetailItem retail = new RetailItem("Description", 1, 10.00, 10.00);
                    Scanner keyboard = new Scanner(System.in);
                    System.out.println("Enter quantity: ");
                    q = keyboard.nextInt();
                    CashRegister receipt = new CashRegister(retail, q);
                    FileWriter fwriter = new FileWriter("SalesReceipt");
                    PrintWriter outputFile = new PrintWriter(fwriter);
    "Receipt.java" 31L, 835C                                     1,1           Top
    import java.util.Scanner;
    import java.io.*;
    public class Receipt
            public static void main(String[] args) throws IOException
                    int q;
                    RetailItem retail = new RetailItem("Description", 1, 10.00, 10.00);
                    Scanner keyboard = new Scanner(System.in);
                    System.out.println("Enter quantity: ");
                    q = keyboard.nextInt();
                    CashRegister receipt = new CashRegister(retail, q);
                    FileWriter fwriter = new FileWriter("SalesReceipt");
                    PrintWriter outputFile = new PrintWriter(fwriter);
                    outputFile.println("\tSALES RECEIPT");
                    outputFile.println("Unit Price: $" + retail.getRetail());
                    outputFile.println("Quantity: " + q);
                    outputFile.println("Subtotal: $" + receipt.getSubtotal());
                    outputFile.println("Sales Tax: $" + receipt.getTax());
                    outputFile.println("\nTotal: $" + receipt.getTotal());
            outputFile.close();
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
    ~
                                                                                                                                                  1,1           All

    You know, the compiler errors also give you more detail than "isn't compiling for me". Do you expect people here to compile it for you to see the error you're already seeing and witholding?

  • Please, I need help debugging compiler error

    I am new to Java and I do not know why the compiler (Forte for Java) has the following error. Seems like the compiler does not accept NEW for adding new entries to a Vector table.
    ERROR:
    UAL_LearningPrograms/MyVector.java [12:1] non-static variable this cannot be referenced from a static context
    mv.vtable.addNode(new Node(names[n]));
    JAVA CODE:
    package UAL_LearningPrograms;
    import java.util.*;
    class MyVector {
    private Vtable vtable;
    public static void main(String[] args){
    MyVector mv = new MyVector();
    String names[] = {"one","two","three","four","five"};
    for (int n;n<names.length;n++)
    mv.vtable.addNode(new Node(names[n]));
    public MyVector(){  // Class constructor
    System.out.println("MyVector_C");
    vtable = new Vtable();
    public class Node {
    private String name;
    public Node(String s){name=s;}
    public class Vtable extends Vector {
    private Vector v;
    public Vtable(){v=new Vector();}
    public void addNode(Node n){v.add(n);}

    You were trying to reference a non-static variable
    from a static context... not allowed.
    Simple modification allows that code to work.
    If this helps... give me the dollars... thanks!
    import java.util.*;
    class MyVector
         private Vtable vtable;
         public static void main(String[] args)
              String names[] = {"one","two","three","four","five"};
              MyVector mv = new MyVector();
              mv.vtable.addNodes(names);
         } // main
         public MyVector()
              System.out.println("MyVector_C");
              vtable = new Vtable();
         } // MyVector
         public class Node
              private String name;
              public Node(String s)
                   name = s;
              } // Node
         } // Node
         public class Vtable
              extends Vector
              private Vector v;
              public Vtable()
                   v=new Vector();
              } // Vtabl3
              public void addNodes(String n[])
                   for (int i = 0; i < n.length; ++i)
                        v.add(new Node(n));
              } // addNode
              public void addNode(Node n)
                   v.add(n);
              } // addNode
         } // Vtable
    } // MyVector

  • PSE 5 - Runtime Error - Solution PLEASE....

    I have run PSE 5 on a Windows XP Home Edition computer successfully for about 3 years, recently I split the Organiser in two with no problem. But now I cannot open the Organiser properly, its comes up "Not Responding" as `Topless Holidays.psa`, no idea how this came about. Cannot close this window without having an Error Box - "Microsoft Visual C ++ Runtime Library. be\PhotoshopElementsOrganiser.exe. This is followed by "The application has requested the Runtime to terminate it in an unusual way. Please contact the application's support team for more infornation." I have found no easy solution for this, uninstalling/re-installing does not work either. I have limited knowledge of computers so a step by step solution would be most helpful and gratefully received. Thank you.

    Please go to %appdata%\adobe\elements organizer\5.0\organizer and delete psa.prf ans status.dat files. I'm not sure if these used to exist for PSE5 since i don't have PSE5.
    Another thing to try is launch organizer keeping Shift key pressed and create a new catalog. This might help you t atleast get started with organizer if its only the old catalog that got affected due to abrupt shut down.
    Thanks
    Andaleeb

  • I NEED HELP WITH SYSTEM ERROR 70190610 PLEASE!!

    I ASKED MY DAUGHTER TO SET UP A PASSWORD FOR ME, AND NOW I CANT GET INTO IT AGAIN
    IT GIVES ME AN ERROR CODE OF 701906 AND THEN IT LOCKS UP  PLEASE HELP  THANKS!!!
                                                                                                                                                                         DIANA C.
    This question was solved.
    View Solution.

    Hi Diana,
    Try entering:      65898236
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • Need help with compile error: externally visible definition

    I am getting the following error on compile:
    "A file found in an source-path must have an externally
    visible definition. If a definition in the file is meant to be
    externally visible, please put the definition in a package."
    Typically this would mean that an actionscript class file is
    not placed in a package, but I am getting the error for a Custom
    MXML ListItemRenderer component I created.
    Does anyone have a clue why this would be happening? It
    happened once before and mysteriously went away after I removed all
    of the code in the file, saved it, pasted it back in and saved it
    again. Unfortunately that is not working this time.
    I would really appreciate any help.
    Thanks,
    shaun

    OK here it is, first i'll give u the Card.java file, it compiles i think:
    public interface Card {
    /** The four suites. */
    public static final byte CLUB = 0, DIAMOND = 1, HEART = 2, SPADE = 2;
    /** The suite of this card. */
    public byte suite();
    * Is 's' a valid suite?
    * @param s a value to check to see if it is a valid suite.
    * @return true iff 's' is a valid suite.
    public boolean validSuite(byte s);
    /** The thirteen standard cards. */
    public static final byte ACE = -1, TWO = -2, THREE = -3, FOUR = -4,
    FIVE = -5, SOX = -6, SEVEN = -7, EIGHT = -8, NINE = -9, TEN = -10,
    JACK = -11, QUEEN = -12, KING = -13;
    /** The face-value of this card */
    public byte value();
    * Is 'v' a valid face-value?
    * @param v the value to check to see if it is a valid face-value.
    * @return true iff 'v' is a valid face-value.
    public boolean validValue(byte v);
    * @param a_card the card to compare
    * @return true iff the suite of this card is identical to the suite
    * of <code>a_card</code>
    public boolean sameSuiteAs(Card a_card);
    * @param a_card the card to compare
    * @return true iff the face value of this card is identical to the
    * face value of <code>a_card</code>
    public boolean sameFaceValueAs(Card a_card);
    * @param a_card the card to compare
    * @return true iff the face value of this card is strictly greater than
    * the face value of <code>a_card</code>
    public boolean greaterFaceValueThan(Card a_card);
    * Whether this card has a greater value than <code>a_card</code> is
    * determined by a given card game's rules.
    * @param a_card the card to compare
    * @return true iff this card has a great value than <code>a_card</code>
    public boolean greaterValueThan(Card a_card);
    * Two cards are equivalent if they are indistinguishable in a given
    * card game's rules.
    * @param a_card the card to compare
    * @return true iff this card and <code>a_card</code> are indistinguishable
    public boolean equivalentTo(Card a_card);
    }

  • Help finding this error!!

    could some one please help me with finding this one error.. i dont understand the problem.. this is the error
    C:\dateDiff.java:1: 'class' or 'interface' expected
    public static long dateDiff (Date dateX, Date dateY) {
    ^
    1 error
    this is the code
    public static long dateDiff (Date dateX, Date dateY) {
    long difference = reducePrecision(dateX, Calendar.DAY_OF_MONTH).getTime() -
    reducePrecision(dateY, Calendar.DAY_OF_MONTH).getTime();
    long daysBetween = (difference + MILLIS_IN_DAY / 2) / MILLIS_IN_DAY;
    return daysBetween;
    private static Date reducePrecision (Date date, int maxPrecision) {
    Calendar cal = Calendar.getInstance();
    cal.setTime(date);
    switch (maxPrecision) {
    case Calendar.YEAR:
    cal.set(Calendar.MONTH, 0);
    case Calendar.MONTH:
    cal.set(Calendar.DAY_OF_MONTH, 1);
    case Calendar.DAY_OF_MONTH:
    cal.set(Calendar.HOUR_OF_DAY, 0);
    case Calendar.HOUR:
    cal.set(Calendar.MINUTE, 0);
    cal.set(Calendar.AM_PM, Calendar.AM);
    case Calendar.HOUR_OF_DAY:
    cal.set(Calendar.MINUTE, 0);
    case Calendar.MINUTE:
    cal.set(Calendar.SECOND, 0);
    case Calendar.SECOND:
    cal.set(Calendar.MILLISECOND, 0);
    break;
    default:
    throw new IllegalArgumentException(
    "Unsupported maxPrecision: " + maxPrecision);
    return cal.getTime();

    The start of a class definition must begin with a class declaration (package and import statements notwithstanding). Example:public class DateUtil {
        // your class members
    }

  • Newbie needs help on compiling error

    I'm reading java 2 programming for dummies, but can't get this example working. I get an error on line 4, but when I remove 'public' from in front of 'class', Iexplore tells me I need a public constructor. I also get errors on line 94 and 98 where the compilator says that the java.awt.Component has been deprecated. I have no clue what that means..
    Please help me! I'm stuck...
    Here is my code:
    /*line 0*/
    import java.applet.Applet;
    import java.awt.*;
    public class PixApplet extends Applet{
         public void init() {
              Rectgl r = new Rectgl(10,5,Color.red);
              Square s = new Square(10,Color.blue);
              Circle c = new Circle(20,Color.yellow);
              Square s2 = new Square(40,Color.green);
              add(r);
              add(s);
              add(c);
              add(s2);
              add(new PixLabel(r));
              add(new PixLabel(s));
              add(new PixLabel(c));
              add(new PixLabel(s2));
    /*Rectgl*/
    class Rectgl extends Pix {
         /*Constructor*/
         public Rectgl(int width, int height, Color c) {
              myDimension.width = width;
              myDimension.height = height;
              setColor(c);
         /*Draw shape*/
         public void Paint(Graphics g) {
              g.fillRect(0,0,myDimension.width,myDimension.height);
         /*Return area*/
         public double getArea() {
              return (myDimension.width * myDimension.height);
         /*Return perimeter */
         public double getPerimeter() {
              return (myDimension.width + myDimension.height) * 2;
         /*Return kind of shape*/
         public String getKind() {
              return "Rectangle";
    /*Square*/
    class Square extends Rectgl {
         /*Constructor*/
         public Square(int side,Color c) {
              super(side,side,c);
         /*Return kind of shape*/
         public String getKind() {
              return "Square";
    abstract class Pix extends Canvas {
         Dimension myDimension = new Dimension();
         /*Constructor*/
         public void Pix() {
         /*Set object's forground color*/
         public void setColor(Color c) {
              setForeground(c);
         public void paint(Graphics g) {
         public double getArea() {
              return 0;
         public double getPerimeter() {
              return 0;
         public String getKind() {
              return "unknown shape";
    /*line 93*/
         public Dimension preferredSize() {
              return myDimension;
    /*line 97*/
         public Dimension minimumSize() {
              return myDimension;
    class Circle extends Pix {
         private int myRadius;
         /*Constructor*/
         public Circle(int radius, Color c) {
              myRadius = radius;
              setColor(c);
              myDimension.height = myDimension.width = 2 * radius;
         /*Draw shape*/
         public void paint(Graphics g) {
              g.fillArc(0,0,(2 * myRadius),(2 * myRadius),0,360);
         /*Return area*/
         public double getArea() {
              return (Math.PI * (myRadius * myRadius));
         /*Return perimeter*/
         public double getPerimeter() {
              return 2 * Math.PI * myRadius;
         /*Return kind of shape*/
         public String getKind() {
              return "Circle";
    class PixLabel extends TextArea {
         /*Constructor*/
         public PixLabel(Pix s) {
              super( "I am a " + s.getKind() + "\nMy perimeter is " + Double.toString(s.getPerimeter()) + "\nMy area is " + Double.toString(s.getArea()),3,15,SCROLLBARS_NONE);
    }

    OK. You do not need to worry too much about the deprecated messages. They are only warnings and will not stop the program compiling.
    What is the name of the java file that your code is in. It should be PixApplet.java
    How are you compiling it, something like
    javac *.java or javac PixApplet.java
    What is the error you get when you try to compile

Maybe you are looking for

  • Statement of Last Billing Cycle's Calling/Texting Details?

    How can I just get a report of last month's (last billing cycle's) usage details for calls and text messages ~ just looking for basics like phone numbers, dates, times for texting and calling.  I can't seem to access that online now? Thank you.

  • I forgot password. How do I disable it?

    How do I disable my i touch?

  • Is there a way to import a cd into itunes library unchecked by default?

    I'm in the process of importing all of my cd's into itunes library, but I want the tunes unchecked in the library so they won't automatically update into my ipod. Right now I've got itunes set up to automatically import a cd I insert and then eject o

  • Files created in trial (indesign) will not open.

    The files I created in the trial version of Indesign CC will not open now that I have the monthly subcription to Indesign CC. They are .indd and .idml Files. When trying to open them I get a message that says "no application is able to open these fil

  • Is it possible to use board without MAX

    Hi All, I am develloping an Application that will use a NI USB measurement module. This Application is going to be distributed and used in the production in different industries. I don't want that an operator can change the channel settings in the MA