I have tried for two hours searching many forums, but could not manage to make my package executable. I have done evrything in notepad, terminal and linux.
My java package path /user/name/documents/mywork/filesystem -> filesystem is the package
in filesystem i got six classes with main class as executefilesystem.java and in /mywork folder i got some textfiles for working in the main class such as read write etc
now how should I run and from which folder?
I tried running from being in filesystem folder by typing in terminal jar cvf filesystem.jar *
it makes filesystem.jar and manifest file which is empty
I added in manifest file
MAIN-CLASS: executefilesystem //->with a newline
and after I failed running the jar as executable modifed the manifest by addind filesystem.executefilesystem AND also filesystem/executefilesystem
Everytme i tried running java jar filesystem.filesystem.jar or java -jar filesystem.jar
giving me either could not load main class OR unable to access jar file filesystem.jar
This is my last [art before I run my simple access control program but I cant seem to make it executable!!!
It's a good idea to structure your projects. Having a package folder outside of a project folder is generally a bad idea. Lets say your project is called FileSystem. This is how you could structure it:
When you have the command prompt open in the project folder (FileSystem/), you can run the following commands:
The first command will compile your source code in the src/ folder and generate classes in the bin/ folder.
The second command will create a jar file in the dist/ folder and include the manifest file from the src/ folder and the filesystem package from the bin/ folder.
The final command will run the jar file from the dist/ folder.