“working ‘java -cp’ not working all of a sudden in ubuntu”

huangapple go评论56阅读模式
英文:

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

问题

我们有以下的Java命令,之前一直运行正常,突然间停止工作了:

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

这个jar包在lib目录下,而且jar包中包含了这个类。
突然间它停止工作了,并显示了以下错误:

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

为什么它把 '-cp' 当作了主类,即使 ppp(例如)有主类。请帮我解决这个问题...

英文:

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...

答案1

得分: 1

使用此命令而非默认的连字符,在 java -cp "classes:lib/*" xxx.yyy.ppp 前加上连字符:java -cp "classes:lib/*" xxx.yyy.ppp

英文:

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

huangapple
  • 本文由 发表于 2020年8月25日 22:39:16
  • 转载请务必保留本文链接:https://go.coder-hub.com/63581290.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定