This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Servlets and the fly likes Help!!!!! calling an instance of a class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Help!!!!! calling an instance of a class " Watch "Help!!!!! calling an instance of a class " New topic
Author

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

nash avin
Ranch Hand

Joined: Nov 13, 2003
Posts: 96
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
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 32508
    
214

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


[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
nash avin
Ranch Hand

Joined: Nov 13, 2003
Posts: 96
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
Craig Jackson
Ranch Hand

Joined: Mar 19, 2002
Posts: 405
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).
 
Have you checked out Aspose?
 
subject: Help!!!!! calling an instance of a class
 
It's not a secret anymore!