• Post Reply Bookmark Topic Watch Topic
  • New Topic

Servlets classes and borkers classes not compiling!  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone,
I am using servlets and jsp to publish a database to an intranet . My problem is that my servlets are not compiling. I am having this error when I complile my servlet :

C:\Tomcat\Tomcat\webapps\CoreData\WEB-INF\classes\ProjectServlet.java:38: package broker does not exist
private broker.RelationBroker rb = broker.RelationBroker.getRelationBroker();
And when I compile a broker class I have this error:
C:\Tomcat\Tomcat\webapps\CoreData\WEB-INF\classes\broker\ProjectBroker.java:157: package core does not exist
core.Project dr = new core.Project();

I have a package called "broker" for my brokers and anpther package called "core' for my bean classes in my classes package. i don't know why it's not compiling.
As a result I can't test my program since when I call my servlet class from my jsp page, the servlet class is not found because it has not been compiled.
I hope I am in the write forum for this.
Please help.Thanks
 
Bartender
Posts: 9444
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to add the base directory of your project, the directory above core and broker, to the classpath. If you add the base directory of your source tree as well, the compiler will find and compile out-of-sync source files. Check this article in the FAQ
 
Gloria Hans
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how do i add the source directory?
My code looks like this in my servlet:

public class ProjectServlet extends HttpServlet
{
//Variables

private String pass;
private String url;
private String driver;
private broker.RelationBroker rb = broker.RelationBroker.getRelationBroker();
private Connection con = rb.getConnection();
....
I've addded the source like this:
private classes.borker.RelationBroker rb= classes.broker.Relation....
but it still doesn't work..
 
Joe Ess
Bartender
Posts: 9444
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Marcy KL:
how do i add the source directory?
My code looks like this in my servlet:

Not to your code. To the classpath. Check the article.
 
Sheriff
Posts: 9082
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Joe Ess:
Check this article in the FAQ
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!