英文:
error:package doesn't exist while compiling java code
问题
以下是翻译好的内容:
我正在尝试编译我的Java文件,但出现了错误:
错误:包不存在
项目目录结构:
project/src/test/java/com/mypack/Test.java
我的测试文件包括:
import org.apache.ibatis.jdbc.ScriptRunner;
import org.h2.tools.Server;
我正在执行:
在位置src/test/java/com/mypack
执行 javac Test.java
,但它没有解析依赖关系,并且显示包不存在的错误。
错误:找不到包org.apache.ibatis.jdbc
import org.apache.ibatis.jdbc.ScriptRunner;
错误:找不到包org.h2.tools
import org.h2.tools.Server;
英文:
I am trying to compile my java file but it is giving error:
error:package doesn't exist
Project Directory structure:
project/src/test/java/com/mypack/Test.java
My test file include:
import org.apache.ibatis.jdbc.ScriptRunner;
import org.h2.tools.Server;
I am doing:
javac Test.java
at location src/test/java/com/mypack
but it is not resolving the dependencies and giving package doesn't exist error.
error: package org.apache.ibatis.jdbc does not exist
import org.apache.ibatis.jdbc.ScriptRunner;
error: package org.h2.tools does not exist
import org.h2.tools.Server;
答案1
得分: 1
我不知道你使用的构建系统是什么,但我猜你是手动使用javac进行编译。请确保包括其他库。请查看这个链接,这可能会对你有所帮助。
https://stackoverflow.com/questions/5112607/how-to-include-libraries-in-java-without-using-an-ide
英文:
I don't what build system you are using but realizing that you are using javac i guess you are manually compiling it. Please make sure including other libraries as well. Please see the link this might help you
https://stackoverflow.com/questions/5112607/how-to-include-libraries-in-java-without-using-an-ide
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论