J2SE, J2EE, CLASSPATH

R

Razvan

Hi!





When I am trying to compile some EJB and I get the error:

mrazvan@razvan /cygdrive/d/work/java
$ javac ejb/demo/Demo.java
ejb/demo/Demo.java:17: package javax.ejb does not exist
import javax.ejb.*;

The compiler cannot find the package javax.ejb. I jave correctly
installed J2SE. Do I need to install J2EE ?
I know that some people istall both J2SE and J2EE ? Does that
make any sense ?

I think that the classpath must be modified. Can somebody tell me
what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
Cygwin)



Regards,
Razvan
 
S

Sean Chou

When I am trying to compile some EJB and I get the error:

mrazvan@razvan /cygdrive/d/work/java
$ javac ejb/demo/Demo.java
ejb/demo/Demo.java:17: package javax.ejb does not exist
import javax.ejb.*;

When compiling, you need the j2ee.jar in your classpath. You can always
use the one from your app server if you don't have the one from the
j2ee sdk.
The compiler cannot find the package javax.ejb. I jave correctly
installed J2SE. Do I need to install J2EE ?
I know that some people istall both J2SE and J2EE ? Does that
make any sense ?

I think that the classpath must be modified. Can somebody tell me
what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
Cygwin)

You shouldn't have to worry about it at run-time. It should be part of
JBoss' classpath already.
 
S

Sudsy

Razvan wrote:
The compiler cannot find the package javax.ejb. I jave correctly
installed J2SE. Do I need to install J2EE ?
No.

I know that some people istall both J2SE and J2EE ? Does that
make any sense ?

In certain situations. Not yours.
I think that the classpath must be modified. Can somebody tell me
what the CLASSPATH should be ? (I have Tomcat + Jboss + J2SE + Win32 +
Cygwin)

In your $JBOSS_HOME/client directory is a file named jboss-j2ee.jar
which contains what you require. Add it to your CLASSPATH.
 
R

Razvan

Indeed, it works if I modify the CLASSPATH like this:

CLASSPATH=.;D:\jboss-3.2.5\client\jboss-j2ee.jar



Thanks,
Razvan
 
S

Sudsy

Razvan wrote:
When should I do something like that ?

Prime example: when you're developing servlets or EJBs but don't have a
servlet container or J2EE server on your machine. You'd need access to
the J2EE jars in order to compile your code.
As you've seen with JBoss, most containers and J2EE servers include the
libraries you need. If you have Tomcat 3 installed then the jar is in
$TOMCAT_HOME/lib/common/servlet.jar. With Tomcat 4 you'll find it in
$TOMCAT_HOME/common/lib/servlet.jar. It's not a complete J2EE jar: it
only includes those elements required for writing servlets and JSPs.
Fair enough?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top