如何在没有IDE的情况下在项目中添加/引用.jar文件 [英] How to add/reference .jar files in your project when you don't have an IDE

查看:201
本文介绍了如何在没有IDE的情况下在项目中添加/引用.jar文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Java新手(基本上是LAMP开发人员)。我得到了这个JAVA API来解析 .pst 文件并显示所有收件箱消息。

I am new to Java (basically a LAMP developer). I got this JAVA API to parse .pst files and show all the inbox messages.

我尝试执行给定的 .class 文件,但它会抛出异常。我需要添加/引用API提供的一些 .jar 文件。

I tried executing a given .class file but it throws exceptions. I need to add/reference some .jar files provided by the API.

我没有任何IDE对于Java而言。 Wikihow

I don't have any IDE for Java yet. Wikihow says


当您的Java项目需要JAR
库运行时,您需要
配置项目以包含
库在其构建路径中。
幸运的是,Eclipse使这个
过程变得简单易记。
这里使用的构建版本是Eclipse Java -
Ganymede 3.4.0。

When your Java project requires JAR libraries to function, you have to configure your project to include the libraries in its build path. Fortunately, Eclipse makes this process simple and easy to remember. The build used here is Eclipse Java - Ganymede 3.4.0.

那么,我的配置是什么得做?或者更好地获得Eclipse IDE?我只需要执行一个 .class 文件。

So, what configuration do I have to do? Or is it better to get Eclipse IDE? I just have a single .class file to be executed.

我检查了一些其他问题,但无法得到我的回答 -
如何从命令行向android项目添加外部jar库

A few other questions that I checked but could not get my answer - How to add external jar libraries to an android project from the command line

如何在我自己的Project JAR中包含外部JAR

推荐答案

您应该将它们放在类路径上,喜欢

You should put them on your classpath, like

java -classpath someJar.jar YourMainClass

当然,你也可以为javac做同样的事情。

And, of course, you can do the same for javac.

如果你需要在类路径上有多个jar或目录,你需要使用您平台的默认路径分隔符 。例如,在Windows上,

If you need to have more than one jar or directory on your classpath, you'll need to use your platform's default path separator. For example, on Windows,

java -classpath someJar.jar; myJar.jar YourMainClass

在旁注中,您可能会发现使用IDE管理这类内容更容易。我个人使用了我的略微可编写脚本的编辑器并且管理得很好。但是知道如何通过命令行完成这些工作很好。

On a side note, you might find it easier to use an IDE to manage this sort of stuff. I've personally used just my slightly scriptable editor and have managed fine. But it's good to know how to do this stuff by command line.

这篇关于如何在没有IDE的情况下在项目中添加/引用.jar文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆