• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Where to store class file?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
I wrote a bean file and compiled it.(ex. xxx.java)
It compiles with no error.
But when i called that bean in other servlet file while compiling that servlet file,
error shows 'class xxx not found.'
Pl advice me where to store that class file
and dose i have to make any changes in servlet cofiguration.
Reply soon.
sachin
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Which webserver are you using sachin?
regards,
kichu
 
sachin shinde
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using JavaWebServer2.0
sachin
 
kichu kichu
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi sachin,
Create a folder inside classes\sunexamples.
eg classes\sunexamples\sachin.
save your java file inside this folder.
See that in the java file you save here,you should specify the package as
package foldername(sachin in this case).
hope that helps,
kichu
 
sachin shinde
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello sir,
Thank you for reply!
I did accourding to yr suggession but Still it is showing same errer message.
If I run simple servlet file it works properly,but while creating instance of bean in that servlet file it shows class not found of that bean error.
Regards,
sachin
 
Ranch Hand
Posts: 96
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sachin,
1> Every class should be in the same package.So,the line "package sachin;" should be in every class;
2> Did you import your bean class in your servlet?
See the error message again and Keep trying!
ruijin yang
 
sachin shinde
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello friends,
Thanks for ur reply!
I got the output. The actual problem was classpath is not proprealy set. and instead od saving class file in public_html i was saving it in Classes folder.
It is correct or because of class path it is taking it from public_html.
I am trying for both.
Pl reply your suggessions.
Thanks for your favourable reply.

regards,
sachin
 
CLUCK LIKE A CHICKEN! Now look at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic