Ol1v3r
Ol1v3r

Reputation: 788

Calling Java from command line - Linux vs Windows

On Windows I run the following command and it work;

java -cp "./libs/*;" SampleJavaApp

When I try to run the same command on Linux (CentOS 6) I get

Error: Could not find or load main class SampleJavaApp

SampleJavaApp has no package

Any insight as to why would be appreciated.

Thanks

UPDATE

The Java Version was the problem, as well as the :

Upvotes: 0

Views: 336

Answers (1)

Daniel Pryden
Daniel Pryden

Reputation: 60997

The format of the classpath (-cp argument) uses the operating system path separator, to match the behavior of PATH. So you want : instead of ; for separating paths.

Also, you seem to be using an empty path element when I think you want to explicitly reference the current directory ..

Also, I think the handling of the * wildcard varies by Java implementation, so you need to make sure the versions match.

Upvotes: 2

Related Questions