wood burning stoves 2.0*
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
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 30382
    
150

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


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, 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).
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Help!!!!! calling an instance of a class