Search code examples
javaclassruntimeclasspathjava-runtime-compiler

working 'java -cp' not working all of a sudden in ubuntu


We have the below java command which was running and stopped working all of a sudden,

java –cp "classes:lib/*" xxx.yyy.ppp

The jar is within lib directory and the jar contains the class. It stopped working all of a sudden and gived the below error,

"Error: Could not find or load main class –cp"

Why is it considering '-cp' as the main class, even though ppp (example) has the main class. Please help me out with this...


Solution

  • You are not using a default hypen before cp as java –cp "classes:lib/*" xxx.yyy.ppp

    Use this instead : java -cp "classes:lib/*" xxx.yyy.ppp