[关闭]
@StarSky 2017-08-08T07:56:38.000000Z 字数 1159 阅读 381

2017-08-01 jar vs tomcat

工作日记


finally, tomcat give up to jar.
ref:
1. how to get a jar use IDEA.
https://stackoverflow.com/questions/42196697/adding-external-library-to-artifact-jar-in-intellij-idea

  1. how to get a jar with command
    https://docs.oracle.com/javase/7/docs/technotes/tools/windows/jar.html

https://stackoverflow.com/questions/13030675/could-not-find-or-load-main-class-with-a-jar-file#comment32461004_18524914
build the class dir

$ javac IdcardRecognizerJNI.java -d .

get a catalogue like this structure(MANIFEST need to be write by yourself)

$ tree
.
├── com
│   └── jd
│       └── jrdp
│           └── recognizer
│               └── util
│                   └── IdcardRecognizerJNI.class
├── IdcardRecognizerJNI.java
├── JNItest.jar
└── META-INF
    └── MANIFEST.MF

MANIFEST.MF:

Manifest-Version: 1.0
Created-By: 1.7.0_71 (Oracle Corporation)
Main-Class: com.jd.jrdp.recognizer.util.IdcardRecognizerJNI

build a .jar:

$ jar cmf META-INF/MANIFEST.MF JNItest.jar com/jd/jrdp/recognizer/util/IdcardRecognizerJNI.class 

run a .jar

$ java -cp JNItest.jar com.jd.jrdp.recognizer.util.IdcardRecognizerJNI

run a .jar with it's dependency

$ java -cp .:commons-collections-3.2.1.jar:commons-lang-2.6.jar:gson-2.2.4.jar:JNItest-1.0-SNAPSHOT.jar:jrdp-common-1.0-SNAPSHOT.jar com.jd.jrdp.recognizer.util.IdcardRecognizerJNI > log.log
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注