廣告

2015年4月20日 星期一

[linux] Run jar on linux with command line


here is java test code
package testJava;

public class testLinuxArg {

 public static void main(String[] args) {

  System.out.println("args lenght:" + args.length);

  for (int i = 0; i < args.length; i++) {
   System.out.println("args:" + i + " is : " + args[i] + " type   is "
     + args[i].getClass() + "  length is " + args[i].length());
  }
 }
}

export as jar,
put it to your linux

run jar on linux
 java -cp "the lib you need" fileName
 ex: java -cp "./*:./lib/*" testJava.testLinuxArg "1" "" "3" $(pwd)


沒有留言:

張貼留言