I'm trying to use a class on my index.jsp file on tomcat 7.0.52. I'm running the webapp using a WAR file, /test/WEB-INF/classes/matrix.class compiled it from matrix.java in the same directory. I get the error
An error occurred at line: [14] in the generated java file: [/var/lib/tomcat7/work/Catalina/localhost/test2/org/apache/jsp/index_jsp.java] The import my_matrix cannot be resolved
index.jsp:
<%@page import="my_matrix"%>
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Apache Tomcat</title>
</head>
<body>
<%
System.out.println( "Evaluating date now" );
java.util.Date date = new java.util.Date();
%>
Hello! The time is now
<%
out.println( date );
out.println( "<BR>Your machine's address is " );
out.println( request.getRemoteHost());
matrix test = new matrix();
%>
<br><br>
<form method="get">
<td><input type="number" name="lim" value="0"></td>
<input type="submit" value="Submit">
</form>
<%
int n = 0;
if(request.getParameter("lim") != null)
n = Integer.parseInt(request.getParameter("lim"));
%>
<TABLE BORDER=2>
<%
for ( int i = 0; i < n; i++ ) {
%>
<TR>
<TD>Number</TD>
<TD><%= i+1 %></TD>
</TR>
<%
}
%>
</TABLE>
</body>
</html>
matrix.class (matrix.java):
package my_matrix;
public class matrix
{
public void myMatrix()
{
System.out.println("dbpool evidence!");
}
}