GeeCON Prague 2014*
The moose likes EJB and other Java EE Technologies and the fly likes Can't compile ejb java source files using JBoss 5 libraries (javax.ejb does not exist) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic
Author

Can't compile ejb java source files using JBoss 5 libraries (javax.ejb does not exist)

Anton Shaykin
Ranch Hand

Joined: Dec 13, 2009
Posts: 57

Hi all!
I feel so frustrated, that I can't compile simple ejb source files for about 2 days.
So I've got JBoss AS 5 installed and I have my classpath set as .; C:\jboss\lib\concurrent.jar; C:\jboss\lib\jboss-common.jar; c:\jboss\client; c:\jboss\lib\commons-httpclient.jar; C:\jboss\server\all\lib; C:\JBoss\common\lib; C:\JBoss\server\all\deployers\ejb3.deployer; C:\JBoss\server\all\deployers\jboss-aop-jboss5.deployer;
Maybe there's something extra in my classpath, but never mind.
So when I try to run javac in the following manner
C:\Java EE Projects\SimpleSessionApp\javac client\*.java
I get "package javax.ejb does not exist" and "cannot find symbol symbol: class Remote"
What can I do to get it to work?
Please, help me, as I'm completely stuck at this problem.
I know that I should add something to my classpath but what exactly?
Thanks in advance!
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
You have a couple of directories in the classpath - be aware that that will NOT add the individual jar files in those directories to the classpath. All jar files need to be listed explicitly.


Ping & DNS - my free Android networking tools app
Anton Shaykin
Ranch Hand

Joined: Dec 13, 2009
Posts: 57

OK, but are you aware of what .jar files should I specify in classpath?
Anyway, how can I scan in what jar file the javax.ejb package resides?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
On the command line, you can use "jar -tf some.jar" to find out which classes are in a jar file.
Anton Shaykin
Ranch Hand

Joined: Dec 13, 2009
Posts: 57

Hooray! Finally, I have compiled my classes!
Weird though, that even after setting classpath as an environment variable the compiler output errors (such as package javax.ejb does not exist).
Only after compiling with -classpath flag and explicitly telling compiler where to look for javax.ejb package sources have successfully compiled.
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42039
    
  64
I advise not to ever use the environment variable, it creates all kinds of problems. Just use the -classpath switch, and -for more complex applications with multiple jar files- learn to use and love Ant for all build tasks.
Anton Shaykin
Ranch Hand

Joined: Dec 13, 2009
Posts: 57

Ulf Dittmer wrote:I advise not to ever use the environment variable, it creates all kinds of problems. Just use the -classpath switch, and -for more complex applications with multiple jar files- learn to use and love Ant for all build tasks.

Thanks for your advices. I'll try to make use of them.
 
GeeCON Prague 2014
 
subject: Can't compile ejb java source files using JBoss 5 libraries (javax.ejb does not exist)