1

When attempting to run the below command:

java -classpath mycompanychecks.jar:checkstyle-5.7-all.jar \
 com.puppycrawl.tools.checkstyle.Main \
 -c config.xml -r .

I get the error:

Error: Could not find or load main class \

In the directory that I'm running the command from I do have the two jar files, and also I have checked that 'com.puppycrawl.tools.checkstyle.Main' does in fact reside in the 'checkstyle-5.7-all.jar'. As the error seems to refer to the backslash maybe it's a syntactical error? However I'm executing the command exactly as stated on the checkstyle page.

0

1 Answer 1

4

This example you're trying is clearly not about Windows.

Check here:
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html

You need to use ; as separator to say the least.

So you need something like this (this is all one line).

java -classpath c:\test\mycompanychecks.jar;c:\test\checkstyle-5.7-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml -r .

Sign up to request clarification or add additional context in comments.

2 Comments

Using ; as you said and removing the path separators, actually gets rid or the error. I do get another error with the config.xml file but that's another issue. You're answer was correct for this question, thanks. Do you know which OS the original command was intended for?
I think it was about Unix and Linux. I don't know Mac OS. It might work OK on Mac OS too but I am not sure about that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.