Reputation: 33
How, or is it possible, to execute a java app from an unzipped jar. I have unzipped a jar file using 7zip. I found the MANIFEST.MF file and made note of the Main-Class: path which is "com.uwsoft.editor.LevelEditor". I am now trying to execute the unzipped java app by navigating to the directory in the console, which contains the "LevelEditor.class" file, and running the command "java LevelEditor" in the console. I get the error "Error: Unable to find or load main class LevelEditor". I can successfully execute the jar file from the console and I can even repackage the jar file and execute it. I am hoping I can that I can execute the app without repackaging it. Please excuse the noob question, I'm a .net developer new to java.
Upvotes: 3
Views: 661
Reputation: 201517
You need to move up three folders from there, so
cd ..\..\..\
to the folder that contains com
. Then
java -cp . com.uwsoft.editor.LevelEditor
Because java packages correspond to folders in the file-system. To quote What Is a Package?
Conceptually you can think of packages as being similar to different folders on your computer.
Upvotes: 4