wu :: forums (http://www.ocf.berkeley.edu/~wwu/cgi-bin/yabb/YaBB.cgi)
general >> wanted >> Problem in java
(Message started by: gotit on Feb 14th, 2008, 6:58am)

Title: Problem in java
Post by gotit on Feb 14th, 2008, 6:58am
I  am visiting this forum after a long time as I was busy with my project. And ironically it is this project that brings me back to the forum.
Before I state my problem, let me inform you that I am working with jdk 1.5 and tomcat 5.5.
Now for the problem:
I create a package called "mypack" and a class called testClass.java. I compile the java file and put the testClass.class file in the mypack directory. I then put the entire mypack directory under webapps/testcodes/WEB-INF/classes directory.
Now I create a JSP file which contains the following line
<%@ page language="java" import ="mypack.testClass" %>
and I create an object of testClass. But when I compile the jsp file, I get an error which says that
testClass cannot be resolved. Can anyone please give a solution to this. It's urgent.

Title: Re: Problem in java
Post by Grimbal on Feb 14th, 2008, 7:09am
It sounds right.

Have you declared the package in the source of testClass?

Usually class names start with an uppercase.  Do you mix up the cases?

Can you otherwise execute JSP pages?

Title: Re: Problem in java
Post by SMQ on Feb 14th, 2008, 7:17am
It looks to me like you're doing everything right; is it possible that tomcat is running under an older version of Java than what you're compiling with?

--SMQ

Title: Re: Problem in java
Post by Grimbal on Feb 14th, 2008, 7:20am
Have you restarted tomcat after copying the .class file to the classes directory?

Title: Re: Problem in java
Post by gotit on Feb 14th, 2008, 9:15pm
Yes to all except Grimbal's last question. After reading Grimbal's last question, I restarted Tomcat and it worked!!

Thanks a lot Grimbal and SMQ.

Title: Re: Problem in java
Post by Grimbal on Feb 15th, 2008, 1:53am
If you need to do it a lot:
http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Reload%20An%20Existing%20Application

But if it is more than a one-week project, you should consider a proper IDE like eclipse.

Title: Re: Problem in java
Post by gotit on Feb 15th, 2008, 2:49am
No. This is not a one-week project. But since it is currently in the development phase, I have added the following in conf/context.xml file:

<Context reloadable="true">

But I understand that once the project goes live, this might degrade the performance and I have to remove the reloadable attribue.
I suppose this is what you meant.

Title: Re: Problem in java
Post by Grimbal on Feb 15th, 2008, 5:25am
That's not what I meant.  In fact, your idea is better.



Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright © 2000-2004 Yet another Bulletin Board