[英]How to import the classes within a jar file in the folder of resources, to another class within a package?
我已经使用 Intellj 创建了一个项目(实际上是 Spring,但我发现这个问题在Java项目和Spring项目之间没有任何关系),其层次结构如下:
I don't quite understand, as on the level of java directory , I could create a java class which could directly use the class within THIS.JAR , while the file within those packages, ie, controller_class.java , I could not find the java class 在THIS.JAR内。 在前一种情况下,当我在THIS.JAR中输入THAT_CLASS时,工具提示将弹出Default package 。
This.jar is a jar file created by myself from another project, I used Maven and pom.xml has been configured. This.jar 包含一些其他模块,如postgresql/antlr 。 但是在java 目录和controller_package的两个级别上,我都可以导入这些模块。 我四处寻找,没有找到解决办法。 作为 Java 的新手,它毁了我的一天,请问有没有人可以帮忙?
如果使用 Eclipse
您可以添加 jar 文件
1- select 右键单击您的项目和 select 属性
2- select java 构建路径
3- select 模块路径然后点击添加外部 JARS
然后检查 JRA SYSTEM LIBRARY 是否存在 jra 文件
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.