[OT] RE: Can't generate class file from Interface
This is not a Tomcat question. Please find a more appropriate list. - Peter -Original Message- From: sam wun [mailto:[EMAIL PROTECTED] Sent: 26 August 2008 13:03 To: Tomcat Users List Subject: Can't generate class file from Interface Hi, In Eclipse 3.4 (not sure about the previous version), I have a project, in the src, there is a interface file called DatabaseCommand.java. This file is an interface file. It s content is shown below: package command; import java.sql.Connection; import java.sql.SQLException; public interface DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException ; } Another file CreateOrder.java *implements* this interface. Its content shown as below: Package command; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; import java.util.ArrayList; import domain.Customer; /** * List existing customers in the database */ public class ListCustomers implements DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException { // List customers in the database ArrayListCustomer list = new ArrayListCustomer(); Statement sta = conn.createStatement(); ResultSet rs = sta.executeQuery(SELECT ID, FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMER); while(rs.next()) { Customer cust = new Customer(); cust.setId(rs.getInt(1)); cust.setFirstName(rs.getString(2)); cust.setLastName(rs.getString(3)); cust.setAddress(rs.getString(4)); list.add(cust); } rs.close(); sta.close(); return list; } } When I press Clt-B to build the project(All), DatabaseCommand.java does not get compiled, no DatabaseCommand.class generated in the build\classes\command\ directory. The syntax highlithed in the CreateOrder.java file indicated that DatabaseCommand is an unknown type, that meant no class found. How can I get around this issue? may be I should ask how to generate an interface dot class file (eg. DatabaseCommand.class in this instance)? 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]
Re: Can't generate class file from Interface
Hi, Make sure about all the classes like Customer, be accessable. And also be careful in naming the packages. 2008/8/26 sam wun [EMAIL PROTECTED] Hi, In Eclipse 3.4 (not sure about the previous version), I have a project, in the src, there is a interface file called DatabaseCommand.java. This file is an interface file. It s content is shown below: package command; import java.sql.Connection; import java.sql.SQLException; public interface DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException ; } Another file CreateOrder.java *implements* this interface. Its content shown as below: Package command; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; import java.util.ArrayList; import domain.Customer; /** * List existing customers in the database */ public class ListCustomers implements DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException { // List customers in the database ArrayListCustomer list = new ArrayListCustomer(); Statement sta = conn.createStatement(); ResultSet rs = sta.executeQuery(SELECT ID, FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMER); while(rs.next()) { Customer cust = new Customer(); cust.setId(rs.getInt(1)); cust.setFirstName(rs.getString(2)); cust.setLastName(rs.getString(3)); cust.setAddress(rs.getString(4)); list.add(cust); } rs.close(); sta.close(); return list; } } When I press Clt-B to build the project(All), DatabaseCommand.java does not get compiled, no DatabaseCommand.class generated in the build\classes\command\ directory. The syntax highlithed in the CreateOrder.java file indicated that DatabaseCommand is an unknown type, that meant no class found. How can I get around this issue? may be I should ask how to generate an interface dot class file (eg. DatabaseCommand.class in this instance)? Thanks Sam -- -Coolest Regards, Praveena Chalamcharla,
Re: Can't generate class file from Interface
- Original Message - From: sam wun [EMAIL PROTECTED] To: Tomcat Users List users@tomcat.apache.org Sent: Tuesday, August 26, 2008 2:02 PM Subject: Can't generate class file from Interface Hi, In Eclipse 3.4 (not sure about the previous version), I have a project, in the src, there is a interface file called DatabaseCommand.java. This file is an interface file. It s content is shown below: package command; import java.sql.Connection; import java.sql.SQLException; public interface DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException ; } Another file CreateOrder.java *implements* this interface. Its content shown as below: Package command; NOT A KEY WORD So they not in the same package, so there is no import command.DatabaseCommand, so its unhappy ;) Not really a tomcat thing... but we friendly ;) import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; import java.util.ArrayList; import domain.Customer; /** * List existing customers in the database */ public class ListCustomers implements DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException { // List customers in the database ArrayListCustomer list = new ArrayListCustomer(); Statement sta = conn.createStatement(); ResultSet rs = sta.executeQuery(SELECT ID, FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMER); while(rs.next()) { Customer cust = new Customer(); cust.setId(rs.getInt(1)); cust.setFirstName(rs.getString(2)); cust.setLastName(rs.getString(3)); cust.setAddress(rs.getString(4)); list.add(cust); } rs.close(); sta.close(); return list; } } When I press Clt-B to build the project(All), DatabaseCommand.java does not get compiled, no DatabaseCommand.class generated in the build\classes\command\ directory. The syntax highlithed in the CreateOrder.java file indicated that DatabaseCommand is an unknown type, that meant no class found. How can I get around this issue? may be I should ask how to generate an interface dot class file (eg. DatabaseCommand.class in this instance)? Thanks Sam --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Can't generate class file from Interface
you need to use Eclipse import to import the package right click on project click Import click File System Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. Date: Tue, 26 Aug 2008 14:02:59 +0200 From: [EMAIL PROTECTED] Subject: Can't generate class file from Interface To: users@tomcat.apache.org Hi, In Eclipse 3.4 (not sure about the previous version), I have a project, in the src, there is a interface file called DatabaseCommand.java. This file is an interface file. It s content is shown below: package command; import java.sql.Connection; import java.sql.SQLException; public interface DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException ; } Another file CreateOrder.java *implements* this interface. Its content shown as below: Package command; import java.sql.Connection; import java.sql.SQLException; import java.sql.Statement; import java.sql.ResultSet; import java.util.ArrayList; import domain.Customer; /** * List existing customers in the database */ public class ListCustomers implements DatabaseCommand { public Object executeDatabaseOperation(Connection conn) throws SQLException { // List customers in the database ArrayListCustomer list = new ArrayListCustomer(); Statement sta = conn.createStatement(); ResultSet rs = sta.executeQuery(SELECT ID, FIRST_NAME, LAST_NAME, ADDRESS FROM CUSTOMER); while(rs.next()) { Customer cust = new Customer(); cust.setId(rs.getInt(1)); cust.setFirstName(rs.getString(2)); cust.setLastName(rs.getString(3)); cust.setAddress(rs.getString(4)); list.add(cust); } rs.close(); sta.close(); return list; } } When I press Clt-B to build the project(All), DatabaseCommand.java does not get compiled, no DatabaseCommand.class generated in the build\classes\command\ directory. The syntax highlithed in the CreateOrder.java file indicated that DatabaseCommand is an unknown type, that meant no class found. How can I get around this issue? may be I should ask how to generate an interface dot class file (eg. DatabaseCommand.class in this instance)? Thanks Sam _ See what people are saying about Windows Live. Check out featured posts. http://www.windowslive.com/connect?ocid=TXT_TAGLM_WL_connect2_082008
Re: Can't generate class file from Interface
On Tue, Aug 26, 2008 at 2:02 PM, sam wun [EMAIL PROTECTED] wrote: package command; Package command; notice the difference? cheers gregor -- what's puzzlin' you, is the nature of my game gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2 gpgp-key available @ http://pgpkeys.pca.dfn.de:11371 - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]