본문 바로가기

IT/java

CMD jar 생성

사전조건

Cmd에서 작업시 CLass 파일의 패키지 경로를 삭제하든가 다시 설정해야 함

오류가 안나는 상태에서 컴파일이 들어가야 정상 작동

Cmd sample1

javac -classpath ./rt.jar;./slf4j-api-1.7.25.jar -encoding utf-8 *.java

java -classpath ./rt.jar;./slf4j-api-1.7.25.jar CompileFileName

 

jar -cvf test.jar *.class rt.jar slf4j-api-1.7.25.jar

**************

1. test.jar 을 오픈한다.

2. META-INF/MANIFEST.MD 파일을 편집한다.

3. Main-class: 실행파일명 추가로 입력한다.

**************

java -jar test.jar

 

구동 확인

Eclipse sample2

Import Project arch

1. 대상 구동 상태 확인

2. export jar file 선택

3. 옵션 설정에서

 Export generated class files and resources

options:

체크 : compress the content of the jar file

체크 :  add directory entries

체크 :  Overwrite existing files without warning

Next > Next

Select the class of the application entry point

Main class : 실행한 JAVA 파일 선택 

Finish

 

'IT > java' 카테고리의 다른 글

C#에서 JAVA 이미지 전송 및 Base64 디코더  (0) 2018.11.16
Java toByteArray  (0) 2018.11.16
NEW URL  (0) 2018.11.16
java thread 모음  (0) 2018.05.02
JAVA에서 브라우저 URL 호출  (0) 2018.05.02