简体   繁体   English

我无法在项目中包含jar文件

[英]I cannot include the jar files in my project

I tried to use a sourceforge library in my program. 我试图在程序中使用sourceforge库。 On my computer I use Eclipse, and I easily add the jar files to my project. 在我的计算机上,我使用Eclipse,并且可以轻松地将jar文件添加到我的项目中。 Now, I want to move the code to another computer. 现在,我想将代码移至另一台计算机。

I tried an executable jar file, but the problem is I cannot debug it on the new computer. 我尝试了一个可执行的jar文件,但是问题是我无法在新计算机上调试它。 So, I decided to move the source code and compile it there. 因此,我决定将源代码移至此处并进行编译。

I tried the following but defeated in all of them: (all in Windows Command prompt) 我尝试了以下操作,但都失败了:(全部在Windows命令提示符下)

  1. Copy the jar files in the /lib/ext folder of my jre folder and add this folder to classpath 将jar文件复制到我的jre文件夹的/ lib / ext文件夹中,然后将此文件夹添加到classpath中
  2. javac -cp ".\\lib\\*.jar" src/*.java
  3. javac -cp "./lib/*.jar" src/*.java

In all of them the classes that are defined in the library jar files can not be recognized by java! 在所有这些库中,java无法识别库jar文件中定义的类! Actually the package doesn't find... 实际上,该包裹找不到...

Any idea? 任何想法? Any stupid thing that I am doing? 我正在做任何愚蠢的事情?

The correct wildcard for matching all jars in a directory is just 匹配目录中所有jar的正确通配符只是

-cp "dir/*"

Please see the Understanding class path wildcards section of this page: Setting the classpath 请参阅本页的了解类路径通配符部分: 设置类路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM