0

I tried many times by making a manifest file with notepad by seeing YouTube videos but it can't be worked

2 Answers2

0

this is quite simple:

open cmd and cd into your directory.
then javac YourProg.java where MyApp.java is your code.
then jar -cf YourJar.jar YourProg.class where YourJar.jar is the new file and YourProg.class is your class.
then you shold have your .jar file in the current cmd directory https://stackoverflow.com/a/9941385/14154066 - similar answer
how-do-i-make-a-jar-from-a-java-file - similar question

0

If you want to create a standalone runnable jar file, you can use

jar -cvf your_prefer_filename.jar -e your_full_main_class_file -C directory_contains_all_classes/ .

it will generate a jar file called your_prefer_filename.jar and then you can run with

jar -jar your_prefer_filename.jar

MK Tan
  • 586
  • 1
  • 4
  • 12