0

我做了一个如下的课程

:~/apache-tomcat-7.0.39/webapps/ROOT/WEB-INF/classes/myclasses$ ls
myLog.class  myLog.java
:~/apache-tomcat-7.0.39/webapps/ROOT/WEB-INF/classes/myclasses$ cat myLog.java
import java.io.*;

public class myLog
{
    private static PrintWriter log = null;
    public myLog(String logpath) throws IOException
    {
        log = new PrintWriter(new FileWriter(logpath, true));
        log.println("Logging started\n");
    }
    p

我正在尝试从我的 jsp 访问相同的内容,如下所示,

<%@ page language = "java" %>
<%@ page import = "myclasses.*" %>
<html>
  <head>
    <title></title>
  </head>
  <body>
  <%
    myLog log = (myLog)application.getAttribute("logfile");
    try
    {
      if (log == null)
      {
        log = new myLog("new.log");

我正面临一个类现在发现异常。我已经重新启动了tomcat。java.lang.NoClassDefFoundError: myLog

谁能告诉我为什么,拜托..

4

0 回答 0