Question

I am getting problem while I am trying to use a class from my jar file.

It is working fine when I am using as a package.

Extra details:

  1. I added build path successfully
  2. now the jar is available in Referenced Libraries
  3. I have imported the package in my JSP file.

While I am trying to run its showing error:

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

An error occurred at line: 17 in the jsp file: /MytestJSP.jsp mathBean cannot be resolved to a type

Here is my JSP code:

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1" **import="com.mypackage.Beans.*"**%>
..................
..................
<body>
    <%!static int Objcount = 0;
    double d;%>
    <h1>
        <%
            String name = request.getParameter("name");
            ***mathBean m = new mathBean();*** //this class available in my jar
            m.setNumber(Objcount);
            d = m.DoubleNum(Objcount);

Thanks in advance.

Was it helpful?

Solution

Finally i got my answer:

to add jar file into build war file, we need to add the jar path into BildPath->Configure Build Path -> Deplyment Assembly

This help to add the jar file into final war file.

OTHER TIPS

Be sure the jar is included on the WEB-INF/lib directory of your war file.

For that, on Eclipse, go to Build Path -> Configure Build Path -> Order and Export, and select the referenced project.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top