ecniv
ecniv

Reputation: 197

Could not find or load main class on linux

I've a standalone application that have the following files:

Under windows, I run the following command with success:

java -cp "main.jar;lib/*" com.ca.Main

No problem the application runs fine. However, on linux operating system, the command fails with the following message:

Error: Could not find or load main class com.ca.Main

If I run

java -cp "main.jar" com.ca.Main

JAVA finds the main class but not the dependencies located in lib/

Any idea of what's wrong with linux ? Is there something to do specific to linux ?

Thanks

Upvotes: 1

Views: 4228

Answers (1)

Hari Menon
Hari Menon

Reputation: 35495

The separator is : instead of ; in linux. So you need to do java -cp "main.jar:lib/*" com.ca.Main.

Upvotes: 4

Related Questions