如何在Java中为外部jar文件设置类路径?

问题描述:

大家好,

我使用Java1.6时没有使用任何IDE.现在我想使用Java Mail API来实现我的目的.因此,我将Mail.jar复制到

Hi All,

I am using java1.6 without using any IDE.Now i want to use java Mail API for my purpose.So, i copied Mail.jar into

d:\externaljar

文件夹中. br/>
而且我也将classpath设置为set classpath =%classpath%; d:\ externaljar;

我的jdk安装文件夹是:c:\ programfiles \ jdk1.6

但是我面对`package javax.mail在编译期间不存在.'

请指导我摆脱这个问题...

folder.

And also i have set the classpath as set classpath=%classpath%;d:\externaljar;

my jdk installation folder is : c:\programfiles\jdk1.6

But i faced `package javax.mail does not exist during compilation.`

Please Guide me get out of this issue...

为什么?

为什么没有IDE?

使用Eclipse或Netbeans.两者都是免费都将指导您.两者都不会编写您的代码-但它们会在诸如此类的任务中为您提供帮助.
WHY?

WHY U NO IDE?

Use Eclipse or Netbeans. both are free Both will guide you. Both will not write your code - but they will help you during tasks like this.


jar文件本身必须位于类路径中,而不仅仅是包含它的目录中
The jar file itself must be in the classpath, and not just the directory containing it