我正在尝试编译Java类。我收到“错误:找不到符号”。
HealthCheckServletTest.java:3: error: cannot find symbol
import com.epoc.base.HealthCheckServlet;
^
symbol: class HealthCheckServlet
location: package com.epoc.base
Test类的代码是
package com.epoc.base;
import com.epoc.base.HealthCheckServlet;
import javax.servlet.http.*;
import java.io.PrintWriter;
import java.io.StringWriter;
import static org.junit.Assert.*;
import static org.mockito.Mockito.*;
public class HealthCheckServletTest {
public void testServlet() throws Exception {
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
when(response.getWriter()).thenReturn(writer);
new HealthCheckServlet().doGet(request,response);
assertEquals("text/html", response.getContentType());
}
}
我的javac命令包含所需的.class文件。它还具有所有其他必需的依赖关系。
javac HealthCheckServletTest.java -classpath /tmp/taxserver/WEB-INF/classes/com/epoc/base/HealthCheckServlet.class:.........
即使类路径中存在.class文件,为什么为什么我仍找不到导入错误?