其实很简单,仔细看看jar的帮助,jar --help
eg.
jar cvf /java/test.jar -C /test/ .

解决方案 »

  1.   

    manifest.mf清单文件如下Manifest-Version:1.0
    Main-Class:lianxi.lianxi     ------->  Main-Class: lianxi
    Created-By:1.4.1 (Sun Microsystems Inc.)jar cvfm lianxi.jar manifest.mf lianxi  -----> jar cvfm manifest.mf lianxi.jar lianxiThis should help.See the following links for more information:
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/basics/build.html
      

  2.   

    F:\work\lianxi>javac lianxi.javaF:\work\lianxi>jar cvfm lianxi.jar manifest.txt lianxi.classmainfest.txt如下:
    Manifest-Version: 1.0 
    Main-Class: lianxi(一定要回車)試試
      

  3.   

    F:\work>jar cvfm manifest.mf lianxi.jar lianxi
    java.io.FileNotFoundException: lianxi.jar (系统找不到指定的文件。)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:103)
            at java.io.FileInputStream.<init>(FileInputStream.java:66)
            at sun.tools.jar.Main.run(Main.java:123)
            at sun.tools.jar.Main.main(Main.java:904) 三楼的如上面显示的错误提示
      

  4.   

    manifest.mf清单文件如下Manifest-Version:1.0
    Main-Class:lianxi
    Created-By:1.4.1 (Sun Microsystems Inc.)F:\work\lianxi\> jar cvfm test.jar manifest.mf *.class晕
    好好看jar的help吧Usage: jar {ctxu}[vfm0M] [jar-file] [manifest-file] [-C dir] files ...
    Options:
        -c  create new archive
        -t  list table of contents for archive
        -x  extract named (or all) files from archive
        -u  update existing archive
        -v  generate verbose output on standard output
        -f  specify archive file name
        -m  include manifest information from specified manifest file
        -0  store only; use no ZIP compression
        -M  Do not create a manifest file for the entries
        -C  change to the specified directory and include the following file
    If any file is a directory then it is processed recursively.
    The manifest file name and the archive file name needs to be specified
    in the same order the 'm' and 'f' flags are specified.Example 1: to archive two class files into an archive called classes.jar:
           jar cvf classes.jar Foo.class Bar.class
    Example 2: use an existing manifest file 'mymanifest' and archive all the
               files in the foo/ directory into 'classes.jar':
           jar cvfm classes.jar mymanifest -C foo/ .