Dev
Dev

Reputation: 3

Main class not found exception in jar

I am trying to execute the performance-meters.jar according to the tutorial at http://marklogic.github.io/performance-meters/tutorial.html

using the command

java -cp performance-meters.jar:xcc.jar com.marklogic.performance.PerformanceMeters

I am getting the following error:

D:\MBS\performance-meters-master\performance-meters-master\classes>java -cp performance-meters.jar:xcc.jar com.marklogic.performance.PerformanceMeters
Exception in thread "main" java.lang.NoClassDefFoundError: com/marklogic/performance/PerformanceMeters
Caused by: java.lang.ClassNotFoundException: com.marklogic.performance.PerformanceMeters
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: com.marklogic.performance.PerformanceMeters.  Program will exit.

I have kept both the jar files in the same folder.

Links to the jar files are: http://developer.marklogic.com/code/performance-meters [http://developer.marklogic.com/products/xcc][3]

Any help would be appreciated.

Upvotes: 0

Views: 737

Answers (2)

Harish Kumar
Harish Kumar

Reputation: 528

You are using windows system or Unix? If windows then I think you need to use ; and not : in separating jars as follows:

java -cp performance-meters.jar ; xcc.jar com.marklogic.performance.PerformanceMeters

Upvotes: 0

mauretto
mauretto

Reputation: 3212

try to use semicolon instead colon in your cp declaration.

java -cp performance-meters.jar;xcc.jar com.marklogic.performance.PerformanceMeters

Upvotes: 1

Related Questions