简体   繁体   English

尽管classpath中有jar文件,但javax.ejb包不存在

[英]package javax.ejb does not exist inspite of jar file in classpath

I'm trying to compile a java program using command 我正在尝试使用命令编译java程序

javac -d build src/*.java -verbose

It returns me the following: 它返回以下内容:

src\Currency.java:5: package javax.ejb does not exist
import javax.ejb.*;
^
src\Currency.java:7: cannot find symbol
symbol: class EJBObject
public interface Currency extends EJBObject {
                              ^ 

I'm using jdk1.6.0_35. 我正在使用jdk1.6.0_35。 CLASSPATH contains C:\\wls1036_dev\\modules\\ which contains javax.ejb.jar CLASSPATH包含C:\\ wls1036_dev \\ modules \\,其中包含javax.ejb.jar

What could possibly be the problem? 可能是什么问题?

I faced the same problem . 我遇到了同样的问题。

You need to add javaee5.jar to you class path . 您需要将javaee5.jar添加到类路径中。

For example I imported an ejb project and then realised I was using a version of Netbeans that did not have the EJB & EAR support . 例如,我导入了一个ejb项目,然后意识到我使用的是一个没有EJB和EAR支持的Netbeans版本。 So i downloaded the plugin . 所以我下载了这个插件。 After doing that the javaee5.jar was present at C:\\Users\\sjauhar\\AppData\\Roaming\\NetBeans\\7.3.1\\modules\\ext . 执行此操作后,javaee5.jar出现在C:\\ Users \\ sjauhar \\ AppData \\ Roaming \\ NetBeans \\ 7.3.1 \\ modules \\ ext中。 Added it to my project and the error went away . 将它添加到我的项目中,错误就消失了。

The classpath must contain the full path to each jar file you want included, not just the folder in which your jar files exist. 类路径必须包含要包含的每个jar文件的完整路径,而不仅仅是jar文件所在的文件夹。 So, for example, add 所以,例如,添加

C:\\wls1036_dev\\modules\\javax.ejb.jar C:\\ wls1036_dev \\模块\\ javax.ejb.jar

to your classpath 到你的类路径

理想情况下,您应该使用WebLogic提供的JDK进行编译,而不是使用J2SE bin和libs。

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

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