Jose
Jose

Reputation: 3548

java.lang.NoClassDefFoundError when running JMS consumer

I am trying to run a class I made however I get this error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/jms/Destination

I don't understand why it's not working even when I include the necessary jars in the classpath:

java consumer1 -cp activemq-all-5.3.2.jar

Upvotes: 5

Views: 25272

Answers (1)

axtavt
axtavt

Reputation: 242786

-cp option of java command should be placed before the class name:

java -cp .;activemq-all-5.3.2.jar consumer1

Otherwise it's treated as an argument of your main method, not as java's argument. Also note that if you specify classpath with -cp option, you need to include the current directory in order to run .class files from it.

Upvotes: 5

Related Questions