Reputation: 456
In general, how can one execute a .class
file through powershell/command prompt that contains packages in it? I'm still having trouble with that.
Assume the file is ClassFile.class
, with the package called Pack
and the class file's location in C:\Program Files\Folderhere\ClassFile.class
.
Upvotes: 0
Views: 182
Reputation: 7335
If the class is in a package called Pack
then you'd do
java Pack.ClassFile
Have you copied the compiled code around at all, moving it from one directory to another? If you have, it's important to maintain the directory structure that it was originally compiled into.
If I was writing some code in a package and compiling and running it, these are the steps I'd take. Assume we've cd'd to a clean directory first.
mkdir Pack
vi Pack/ClassFile.java
javac Pack/ClassFile.java
java Pack.ClassFile
Upvotes: 2