This week's book giveaway is in the Java in General forum.
We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line!
See this thread for details.
Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

servlet packages problem

 
rudolf hitler
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have these 2 codes both placed in the same package called moreservlets.one file is called serutilities.java and the other called helloservlet.java.helloservlet.java uses serutilities.java.I have put c:\moreservlets in my classspath along with "." but my file helloservlet does not compile it gives an error on the line where i use a static method from serutilities.java in helloservlet.java.The access modifier is public for both classes.Can u help me out with what the error might be??
 
Avi Abrami
Ranch Hand
Posts: 1141
1
Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Madhu,
The servlet engines that I have worked with all use their own CLASSPATH -- which is totally independent of yours! So you need to configure your servlet engine's CLASSPATH -- to include "C:\moreservlets".
How you configure the servlet engine's classpath depends on the servlet engine you are using -- but I'm sure the details can be found in the documentation (for your servlet engine).
Hope this helps.
Good Luck,
Avi.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Avi... the problem was with compilation.

madhu, I think I recognize a few names in your post. Are you looking at moreservlets ?

Try this post:
http://www.coderanch.com/t/354473/Servlets/java/Packages-Utility-Classes-Servlets

The most important bit of that post is where I link to *another* post... (for the short version, just go here): http://www.coderanch.com/t/354453/Servlets/java/Unable-compile-package

The important part of THAT post is mine, at the very bottom
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic