After the the demo project is compiled, there are many .class file in the out>production>testPrj>apidemo. Basically, each file will have one .class file
I expect to ente
If the class is in a package:
package mypackagename;
public class MyClassName {
public static final void main(String[] cmdLineParams) {
}
}
You need to use:
java -classpath . MyClassName
Notice the "."
It must be called with its fully-qualified name:
java -classpath . mypackagename.MyClassName
You need to provide the fully qualified name of the class with package name and not include ".class". So you need to place yourself in the parent directory to where ApiDemo.class
is - i.e. out>production>testPrj.
And then execute:
$ java apidemo.ApiDemo
Another way is to provide "out/production/testPrj" as the classpath:
$ java -cp /path/to/out/production/testPrj apidemo.ApiDemo
For running from console you have to do few things:
apidemo.ApiDemo
has main() for lunching your program.javac ApiDemo.java
run compiled files with .class
extension, providing full class name (with packages):
java apidemo.ApiDemo