Java.lang.NoClassDefFoundError when starting a JMS client

I am trying to run the class that I created, but I get this error:

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

I do not understand why it does not work, even when I include the necessary banks in the class path:

java consumer1 -cp ActiveMQ-all-5.3.2.jar

+4
source share
1 answer

-cp java command parameter must be placed before the class name:

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

Otherwise, it is considered as an argument to your main method, and not as a java argument. Also note that if you specify the class path with the -cp parameter, you need to include the current directory in order to run .class files from it.

+3
source

All Articles