一个java程序说要带参数运行,本人刚接触,忘大虾指教下,最好详细点哈^-^        另外怎么样才能把程序打jav包

解决方案 »

  1.   

    带参数的例子:
    java 你的程序名字 参数
    exp: java Test a
    要在cmd里运行.打包例子:
    jar -cvfm test.jar .\manifest.mf *.class
    意思是说把当前文件夹下的所有class文件打包成test.jar。
    manifest.mf是指明程序的入口。manifest.mf文件的内容:
    Manifest-Version: 1.0
    Created-By: 1.6.0-beta (Sun Microsystems Inc.)
    Main-Class: Test.class
    SplashScreen-Image: 7.gif
    得自己试试。
      

  2.   

    不知道为什么我的机器指定了 manifest.mf 文件,出来的 jar 文件中的 META-INF/MANIFEST.MF 未采用我的?
      

  3.   

    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
    at MyClient.main(MyClient.java:10)
    请问这个是什么意思?
      

  4.   

    main 方法中的 args 是一个数组,也就是说你在程序中使用到了 args[0],而你在命令行中并没有给出参数就像:
      java MyClient
    一样,你需使用:
      java MyClient (参数1 参数2 参数3 ...)
    其中的 <参数1> 对应着 args[0],<参数2> 对应着 args[1],依此类推,参数与参数间使用空格分开。