1 개요[편집]

How to export a spring starter project
스프링 스타터 프로젝트 HelloWorld 내보내기
Runnable JAR 만들기
STS Runnable JAR 내보내기

2 실행 환경설정[편집]

  • STS의 Run 메뉴 --- Run Configurations...
  • 왼쪽 리스트의 Java Application 우클릭 --- New --- Name: New_configuration --- Main class: [Search...] 클릭
  • "Select Main Type" --- HelloWorldApplication - com.example 선택 --- [OK]
  • [Apply] --- [Run]

( 기존과 동일하게 잘 실행됨 )

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.3.RELEASE)

2017-05-16 18:00:43.752  INFO 5244 --- [           main] com.example.HelloWorldApplication        : Starting HelloWorldApplication on WIN-QNGP7AV7ERD with PID 5244 (D:\workspace-sts\HelloWorld\target\classes started by user2 in D:\workspace-sts\HelloWorld)
2017-05-16 18:00:43.768  INFO 5244 --- [           main] com.example.HelloWorldApplication        : No active profile set, falling back to default profiles: default
2017-05-16 18:00:43.861  INFO 5244 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@27d415d9: startup date [Tue May 16 18:00:43 KST 2017]; root of context hierarchy
2017-05-16 18:00:44.783  INFO 5244 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-05-16 18:00:44.799  INFO 5244 --- [           main] com.example.HelloWorldApplication        : Started HelloWorldApplication in 1.515 seconds (JVM running for 2.132)
Hello, World!
2017-05-16 18:00:44.803  INFO 5244 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@27d415d9: startup date [Tue May 16 18:00:43 KST 2017]; root of context hierarchy
2017-05-16 18:00:44.804  INFO 5244 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

3 내보내기[편집]

  • Package Explorer의 프로젝트 HelloWorld [boot] 우클릭 --- Export...
  • Runnable JAR file 선택 --- [Next >]
  • Launch configuration: New_configuration - HelloWorld --- Export destination: [Browse...] 클릭
  • "다른 이름으로 저장" --- 바탕화면 선택 --- 우클릭 새 폴더(N) 'HelloWorld' 만들고 들어가기 --- 파일 이름(N): HelloWorld.jar --- [저장(S)][1]
  • (O) Copy required libraries into a sub-folder next to the generated JAR --- [Finish]

4 확인 및 실행[편집]

  • 바탕화면에서 HelloWorld 폴더 더블클릭하여 창 열기
( HelloWorld.jar와 HelloWorld_lib 폴더가 있음 )
  • 창 공간에서 Shift + 마우스 우클릭 --- 여기서 명령 창 열기(W)
C:\Users\user2\Desktop\HelloWorld>java -jar HelloWorld.jar

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v1.5.3.RELEASE)

2017-05-18 10:47:52.520  INFO 3784 --- [           main] com.example.HelloWorldApplication        : Starting HelloWorldApplication on WIN-QNGP7AV7ERD with PID 3784 (C:\Users\user2\Desktop\HelloWorld\HelloWorld.jar started by user2 in C:\Users\user2\Desktop\HelloWorld)
2017-05-18 10:47:52.529  INFO 3784 --- [           main] com.example.HelloWorldApplication        : No active profile set, falling back to default profiles: default
2017-05-18 10:47:52.691  INFO 3784 --- [           main] s.c.a.AnnotationConfigApplicationContext : Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7a36aefa: startup date [Thu May 18 10:47:52 KST 2017]; root of context hierarchy
2017-05-18 10:47:53.723  INFO 3784 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2017-05-18 10:47:53.757  INFO 3784 --- [           main] com.example.HelloWorldApplication        : Started HelloWorldApplication in 1.71 seconds (JVM running for 2.245)
Hello, World!
2017-05-18 10:47:53.760  INFO 3784 --- [       Thread-2] s.c.a.AnnotationConfigApplicationContext : Closing org.springframework.context.annotation.AnnotationConfigApplicationContext@7a36aefa: startup date [Thu May 18 10:47:52 KST 2017]; root of context hierarchy
2017-05-18 10:47:53.763  INFO 3784 --- [       Thread-2] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown

C:\Users\user2\Desktop\HelloWorld>

5 같이 보기[편집]

6 주석[편집]

  1. 아마도... Export destination: C:\Users\사용자명\Desktop\HelloWorld\HelloWorld.jar
문서 댓글
{{ comment.name }} {{ comment.created }}
{{ user_name }}