Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Where to store class file?

 
sachin shinde
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
 
kichu kichu
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
 
ruijin yang
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic