0

I'm trying to invoke a java class that is not in current directory. Ive set -classpath flag and ensured that the class file is also there in the path. But im getting the following error

Error: Could not find or load main class Fileversion

Bat file code

java -classpath x:/LCMSLatestLibrary/Fileversion/Fileversion.class Fileversion H:\LCMS_Jars\client.jar x:\LCMSLatestLibrary\64bit\client.jar
pause

The same works if I cd into x:/LCMSLatestLibrary/Fileversion and execute the above line without -classpath flag. What am I missing?

Cybermonk
  • 514
  • 1
  • 6
  • 28

1 Answers1

4

You have to set as classpath the jar or directory containing your packages. In your case (assuming the class Fileversion is in the default package) the command should be: java -classpath x:/LCMSLatestLibrary/Fileversion Fileversion H:\LCMS_Jars\client.jar x:\LCMSLatestLibrary\64bit\client.jar

Zleurtor
  • 88
  • 7