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

蓝咒 提交于 2020-01-23 08:04:53

问题


I'm trying to compile a java program using command

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. CLASSPATH contains C:\wls1036_dev\modules\ which contains javax.ejb.jar

What could possibly be the problem?


回答1:


I faced the same problem .

You need to add javaee5.jar to you class path .

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 . 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 . Added it to my project and the error went away .




回答2:


The classpath must contain the full path to each jar file you want included, not just the folder in which your jar files exist. So, for example, add

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

to your classpath




回答3:


You should ideally compile using the JDK provided by WebLogic, rather than using the J2SE bin and libs.



来源:https://stackoverflow.com/questions/12875479/package-javax-ejb-does-not-exist-inspite-of-jar-file-in-classpath

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!