Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2006

Tip: Looking for answers? Try searching our database.

Creating a new class instance from a servlet

Thread view: 
Damo - 15 Nov 2006 00:09 GMT
Hi,
I have a servlet and and trying to instantiate a class in the servlet.
I'm using the following code:
engine e = new engine();
The engine class compiles without error but when i compile the servlet
i get 2 errors from this line cannot find symbol. Anyone know what the
problem might be?
Thanks
Manish Pandit - 15 Nov 2006 00:57 GMT
> The engine class compiles without error but when i compile the servlet
> i get 2 errors from this line cannot find symbol. Anyone know what the
> problem might be?

Did you import the correct package? Is the class accessible to the
servlet?

-cheers,
Manish
Damo - 15 Nov 2006 01:07 GMT
the servlet is in the classes folder in a package called Search and the
class i'm trying to instantiate is in Search.model , but it cant find
it. i am importing the search.model folder
thanks

> > The engine class compiles without error but when i compile the servlet
> > i get 2 errors from this line cannot find symbol. Anyone know what the
[quoted text clipped - 5 lines]
> -cheers,
> Manish
itreflects@gmail.com - 15 Nov 2006 04:32 GMT
> the servlet is in the classes folder in a package called Search and the
> class i'm trying to instantiate is in Search.model , but it cant find
> it. i am importing the search.model folder
> thanks

try this:

Search.model.engine e = new Search.model.engine();

and make sure Search.model.engine class is there in runtime CLASSPATH.
hope it helps.
adwords@pulpjava.com - 15 Nov 2006 22:46 GMT
This is a compile time, not a runtime error, right?

-Cameron McKenzie
Author of the SCJA Certification Guide and What is WebSphere?

Certification Resources: www.examscam.com
Free WebSphere Tutorials: www.pulpjava.com
Free Mock Java Certification Exams: www.scja.com
Free J2EE and Java Multimedia Tutorials: www.mcnz.com

> > the servlet is in the classes folder in a package called Search and the
> > class i'm trying to instantiate is in Search.model , but it cant find
[quoted text clipped - 7 lines]
> and make sure Search.model.engine class is there in runtime CLASSPATH.
> hope it helps.
trippy - 16 Nov 2006 05:34 GMT
In article <1163549363.207276.232000@f16g2000cwb.googlegroups.com>,
Damo took the hamburger meat, threw it on the grill, and I said "Oh
Wow"...

> Hi,
> I have a servlet and and trying to instantiate a class in the servlet.
[quoted text clipped - 3 lines]
> i get 2 errors from this line cannot find symbol. Anyone know what the
> problem might be?

Engine e = new Engine(); ?

Just a guess, since you didn't post the error message.

> Thanks

Signature

trippy
mhm31x9 Smeeter#29 WSD#30
sTaRShInE_mOOnBeAm aT HoTmAil dOt CoM

NP: "All I Really Want" -- Alanis Morissette

"Now, technology's getting better all the time and that's fine,
but most of the time all you need is a stick of gum, a pocketknife,
and a smile."

-- Robert Redford "Spy Game"



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.