Reputation: 5
I am running a shell command to run a main class from a jar. I am using the following command-
java -cp ./knowledge-generator.jar com.abc.rdf.file.FileGenerator --inputFiles `pwd`/abc.ttl --outputFolder `pwd`
But everythime I am getting the error-
Error: Could not find or load main class com.abc.rdf.file.FileGenerator
I checked the solution given here but that did not help me. What is going wrong here.
Upvotes: 0
Views: 2537
Reputation: 17595
The error you are getting means that the class you are specifiying is not found on the classpath.
This could be eiether because you have mispelled the class name or the class itself or the jar file containing it is not on the classpath.
Since you are usging ./knowledge-generator.jar
this means that the jar file is located on the same directory from where you are executing the command (current wurking directory). make sure the jar file is there (execute the command ls) and that the jar file contains the class you are trying to use as entry point to your java application
Upvotes: 0
Reputation: 1
Add the full path of the jar that you're adding to your classpath. For example:
java -cp C:/myprog/knowledge-generator.jar com.abc.credit.data.knowledgegenerator.KnowledgeGenerator --inputFiles `pwd`/CIA_CP_LDM.ttl --outputFolder `pwd`
Upvotes: 0
Reputation: 7069
Use following command to run
jar -
java -jar ./knowledge-generator.jar
Upvotes: 2