I have a Raspberry Pi Type Bi with Oracle java installed.
Previously I have been able to run java classes e.g. "java MemoryInfo" and the file would run.
Now I want to include a separate library and cant seem to get it to run. The java files and library run fine in Netbeans.
I am running the command "java -classpath sigar.jar CpuInfo" and is says could not find or load main class. I know the code is correct as it runs on netbeans.
Interestingly I can run "java -classpath sigar.jar MemoryInfo" even though the library is not required, it says the same about not being able to find the main class.
I have the library (sigar.jar) and the class files in the same directory (/home/pi). What am I missing? Help!
I have tried with another java file. It compiles ok with: "javac -cp avis-client.jar HelloWorld.java" but I get the same error when I try to run: "java -cp avis-client.jar HelloWorld"
The exact wording is: "Error: Could not find or load main class HelloWorld"
The location of the jar file is ok as it wouldn't compile without it!
CpuInfo
the fully qualified class name, including the package? Does it say it can't find a main class, or can't find the CpuInfo class? Or can't find the main method of the CpuInfo class?CpuInfo
, notHelloWorld
! Are you sure you're not typingjava -jar sigar.jar CpuInfo
? (I should be clearer,-cp
is correct,-jar
would be wrong in this case)