Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

unnable to create object of a class..

 
K Vidhyakar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created a class Test inside a package called "utilities" . in jsp i have included the package but while calling that page, error is thrown..

package utilities does not exists.. and so on..

can you explain me what may be the problem..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Where did you put this package ? It should be under /WEB-INF/classes
 
K Vidhyakar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im using tomcat server.
but there is no classes folder inside the web-inf folder..
what should i do now?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to create it yourself. For example, make the following structure:

TOMCAT_INSTALL/webapps/myapp/WEB-INF/lib
TOMCAT_INSTALL/webapps/myapp/WEB-INF/classes
TOMCAT_INSTALL/webapps/myapp/WEB-INF/classes/utilities
 
K Vidhyakar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
still its not working..
and i even tried without using package also..

i placed the class in
Tomcat 4.1\webapps\design\WEB-INF\classes
directory..

its telling ..

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Compiling 1 source file

C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\design\Sample_jsp.java:11: cannot resolve symbol
symbol : class Test
location: class org.apache.jsp.Sample_jsp
Test t=new Test();
^
C:\Program Files\Apache Group\Tomcat 4.1\work\Standalone\localhost\design\Sample_jsp.java:11: cannot resolve symbol
symbol : class Test
location: class org.apache.jsp.Sample_jsp
Test t=new Test();
^
2 errors
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please show how you import the class from JSP.
(and you didn't forget the "package utilities;" in Test.java, did you?)
(and Test.class is in /classes/utilities/, isn't it?)
[ October 05, 2006: Message edited by: Satou kurinosuke ]
 
K Vidhyakar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Code is not showing
And when we solve your problem, please take some time to read the naming policy and change your name accordingly. Thank you.
http://www.javaranch.com/name.jsp
 
K Vidhyakar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the Test class which i created is default.
but i changed it to public and its working properly.

thanks a lot in helping me to place the files in correct directory..
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Glad you've found the problem :thumb:
Don't forget about your name ;)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic