• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Help!!!!! calling an instance of a class

 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,
I hope this is the right forum to post this topic.I am doing so cause I am dealing with servlets.In the init() method of a servlet.I want to call an instance of another class UserPresent.java .I will post the code below


The compiler keeps complaining saying that .......
[bold]
AuthenticateServlet21.java:12: cannot resolve symbol
symbol : class UserPresent
location: class package1.structure.AuthenticateServlet21
UserPresent userpresent = new UserPresent();
[/bold]
I have included the package package1.structure in both the servlet code and the UserPresent code.
Kindly let me know what could be the problem.
Help would be appreciated
Thanks
AS
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nash,
Are these two .java files in the same folder on your machine? Also, are you trying to compile them together or separately? Try doing a:
javac *.java
 
nash avin
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply,
I did compile as you directed.
javac *.java but....I am getting the same errors.
Let me know what could be the problem.
Thanks
AS
 
Ranch Hand
Posts: 405
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would first make sure UserPresent.java is in the same directory/folder structure as AuthenticateServlet21.java.

I would suggest, first compiling UserPresent.java and then your servlet.
This will verify that there are no problems with UserPresent.java (i.e. package name, class name etc).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic