I just found  out I have a class missing in the src (command) directory.

I need to create a Customer and Order class and .java file.

The Cusotmer and Order class is related to the database tables Customer and 
Order. 

I am wondering how to create a getters and setters of Customer and Order 
class in Eclipse?



thanks

sam



> ----- Original Message -----
> From: Tandel, Aswin
> Sent: 26/08/08 02:23 am
> To: Tomcat Users List
> Subject: RE: how to reference a class to the current src directory.
> 
> Hi,
> 
> For the classes in the same directory it is not required to give class 
> path reference.
> 
> Chances are that  DatabaseCommand is not compiled.
> Check if you have the class file in bin directory.
> 
> If not then clean the project and build again
> 
> 
> Thanks and Regards,
> Ashwin Tandel
> Email - [EMAIL PROTECTED]
> 
> -----Original Message-----
> From: sam wun [mailto:[EMAIL PROTECTED] 
> Sent: Monday, August 25, 2008 12:04 PM
> To: Tomcat Users List
> Subject: how to reference a class to the current src directory.
> 
> Hi there,
> 
> I have created a Web project using Eclipse 3.4. However, it can't resolve 
> the class reference to the current directory.
> Here is the project layout and description of the problem:
> 
> >DBTest
>  >src
>    > command
>      CommandExecutor.java
>         ...
>         ...
>      DatabaseCommand.java
>         ...
> 
> 
> Double-clicks on the file CommandExecutor.java, it display the following 
> content:
> 
> package command;
> 
> import java.sql.Connection;
> import java.sql.SQLException;
> import javax.sql.DataSource;
> import javax.naming.InitialContext;
> import javax.naming.Context;
> import javax.naming.NamingException;
> 
> /**
>  * Gets and caches data sources, gets connections
>  * Implements Singleton pattern
>  */
> 
> public class CommandExecutor {
> 
>     private static CommandExecutor myOnlyInstance = null;
>     private DataSource ds = null;
>     
>     // accessor method for the singleton
>     public static CommandExecutor getInstance() throws NamingException 
> {
>         if (myOnlyInstance == null) {
>             myOnlyInstance = new CommandExecutor();
>         }
>         return myOnlyInstance;
>     }
>     
>     // Constructor for the singleton
>     private CommandExecutor() throws NamingException {
>         getDataSource();
>     }
>     
>     // get the data source from initial context
>     public DataSource getDataSource() throws NamingException {
>         
>         if (ds == null) {
>             
>             InitialContext ctx = new InitialContext();
>             Context envCtx = (Context) 
> ctx.lookup("java:comp/env");
>             ds = (DataSource) envCtx.lookup("jdbc/TestDB");
>             
>         }
>         
>         return ds;
>     }
>     
>     // get the SQL connection from the database
>     public Connection getConnection() throws NamingException, 
> SQLException {
>         return getDataSource().getConnection();
>         
>     }
>     
>     // execute particular database command
>     public Object executeDatabaseCommand(DatabaseCommand c) throws 
> Exception {
>         
>         Connection conn = null;
>         try {
>             conn = getConnection();
>             Object o = c.executeDatabaseOperation(conn);
>             return o;
>         } catch (SQLException e) {
>             throw e;
>         } catch (NamingException ne) {
>             throw ne;
>         } finally {
>             if (conn != null) conn.close();
>         }
>     }
> }
> 
> The DatabaseCommand has error. Move the cursor onto the name of 
> DatabaseCommand, an error message popup:
> 
> DatabaseCommand cannot be resolved as a type
> 3 quick fixes available:
>   . Add type parameter "DatabaseCommand" to "CommandExecutor"
>   . Add type parameter "DatabaseCommand" to 
> "executeDatabaseCommand(DatabaseCommand)"
>   . Fix Project Setup...
> 
> I think I need to choose the third option "Fix Project Setup".
> 
> Now, from Java Build Path, under the Source menu tab, it has the the 
> following layout:
> DBTest/src
>    Included: (All)
>    Excluded: (None)
>    Native librarylocation (None)
> 
> Look back the very beginning of this post, you can see the class file 
> DatabaseCommand.java file is already defined in the same directory as as 
> CommandExecutor.java defined.
> 
> How to tell Eclipse compiler that the DatabaseCommand class is in the 
> same 
> directory as the CommandExecutor.java?
> 
> Thanks
> Sam
> 
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 

Reply via email to