Could not find or load main class –cp
I have encountered below error while trying to execute wlst script from command line. In fact, this error could come while executing any java program.
Could not find or load main class –cp’. this error was thrown when ‘java –cp /opt/oracle/APP/product/MWHome/wlserver_10.3/server/lib/weblogic.jar weblogic.WLST ServerStatus.py’ was executed.
This issue will come mostly when a command is copy/pasted from web. Little background of different types of dashes will help to better understand this error.
There are 3 types of dashes : hyphens (-), en dashes (–), and em dashes (—). Most of the keyboards have only hyphen and hyphen is the dash used in command lines for passing options/arguments. For more information, read this wikipedia article.
The command in the error had ‘en dash’ which java command line doesn’t have any special meaning. So ti thought it was the class name. Obviously, it would not find the class and threw an indirect error.
Replacing en dash with hyphen resolved issue. Hurry !!!
Comments
Post a Comment