Making manifest file in java by command prompt

Bita Mirshafiee

I'm trying to make a 'jar file' and run it by first making manifest file. as I enter jar command in command prompt and using all explanation, this is what I think is sensible:

>md build\classes          ----first I made a directory for my class files--

>javac -d build\classes src\*.java     ----then compile java files from src folder to classes folder----

>javadoc src\*.java -d doc    ----make documentation----

>jar -cfm my.jar m.txt -C build\classes    ----I want to make a my.jar file and put the manifest contents from .class in build \classes to m.txt but I don't know what's wrong that I can't make a manifest file as m----

java -jar my.jar

I mentioned above the problem in making manifest file so that I can run .jar file. what's wrong with my code for making the manifest file?

this is what it print when I run the command for making manifest file:

Usage: jar {ctxui}[vfmn0Me] [jar-file] [manifest-file] [entry-point] [-C dir] files ...

ManoDestra

Simply add a . at the end of your jar.exe command, or whatever you wish to include from the build\classes directory. The -C command allows you to change directory, but you then need to specify what to include from that directory thereafter.

So...

jar -cfm my.jar m.txt -C build\classes .

I'm assuming that your manifest file is already created. If not, then you can echo via the command line and output it to a file. For example...

echo Main-Class: path.to.YourClass > MANIFEST.MF (or m.txt)

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Command Prompt: java file not found

From Dev

JDBC Java File Running Through Command Prompt

From Dev

JDBC Java File Running Through Command Prompt

From Dev

how to prompt "open file window" from command prompt in java?

From Dev

Running a .BAT file in JAVA without opening a command prompt

From Dev

there's unknown modification error in my batch file, java and command prompt

From Dev

Running a .BAT file in JAVA without opening a command prompt

From Dev

Java Program compiled successfully and class file is generated but no output in Command Prompt

From Dev

Java manifest file

From Dev

Running .class File in Command Prompt

From Dev

Command Prompt change file icon

From Dev

Running .class File in Command Prompt

From Dev

Post file from Command Prompt

From Dev

Java - intellij vs command prompt

From Dev

Incorrect java -version on command prompt

From Dev

Jar command not adding requested manifest file to archive

From Dev

Pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called from a java program

From Dev

Java Compiling Error in Command prompt: class file has wrong version 52.0, should be 50.0

From Java

Install an apk file from command prompt?

From Dev

Glassfish asadmin batch file not opening command prompt

From Dev

Oracle Database import .sql file by command prompt

From Dev

Random file as second parameter in command prompt?

From Dev

How to hide command prompt for batch file

From Dev

Redirecting contents of a file to a variable in command prompt

From Dev

How to open the command prompt from a file

From Dev

Echo HTML in Command Prompt to file loop

From Dev

Use window command prompt split text file

From Dev

Put editable text in command prompt with bat file

From Dev

Doing operations on a file literally called %A% in command prompt

Related Related

  1. 1

    Command Prompt: java file not found

  2. 2

    JDBC Java File Running Through Command Prompt

  3. 3

    JDBC Java File Running Through Command Prompt

  4. 4

    how to prompt "open file window" from command prompt in java?

  5. 5

    Running a .BAT file in JAVA without opening a command prompt

  6. 6

    there's unknown modification error in my batch file, java and command prompt

  7. 7

    Running a .BAT file in JAVA without opening a command prompt

  8. 8

    Java Program compiled successfully and class file is generated but no output in Command Prompt

  9. 9

    Java manifest file

  10. 10

    Running .class File in Command Prompt

  11. 11

    Command Prompt change file icon

  12. 12

    Running .class File in Command Prompt

  13. 13

    Post file from Command Prompt

  14. 14

    Java - intellij vs command prompt

  15. 15

    Incorrect java -version on command prompt

  16. 16

    Jar command not adding requested manifest file to archive

  17. 17

    Pass a string with multiple contiguous spaces as a parameter to a jar file using Windows command prompt called from a java program

  18. 18

    Java Compiling Error in Command prompt: class file has wrong version 52.0, should be 50.0

  19. 19

    Install an apk file from command prompt?

  20. 20

    Glassfish asadmin batch file not opening command prompt

  21. 21

    Oracle Database import .sql file by command prompt

  22. 22

    Random file as second parameter in command prompt?

  23. 23

    How to hide command prompt for batch file

  24. 24

    Redirecting contents of a file to a variable in command prompt

  25. 25

    How to open the command prompt from a file

  26. 26

    Echo HTML in Command Prompt to file loop

  27. 27

    Use window command prompt split text file

  28. 28

    Put editable text in command prompt with bat file

  29. 29

    Doing operations on a file literally called %A% in command prompt

HotTag

Archive