Unable to access jarfile Dspring.profiles.active=

Unable to access jarfile Dspring.profiles.active=

Windows10에서 jar를 실행하다 발생한 문제

 

토이프로젝트 배포테스트를 하다 발생한 문제다.

환경은 Windows10이었으며, PowerShell에서 발생했다.

 

//입력
java -jar Dspring.profiles.active=prod .\dev-dictionary-3.0.jar

//에러발생
Error: Unable to access jarfile Dspring.profiles.active=prod

 

너무 당연하게 돼야할게 안돼면서 뜬금없는 에러가 발생해 약간 헤맸는데,

곰곰이 생각해보니 실행옵션을 jar파일로 인식하여 발생하는 오류로 생각이됐다.

윈도우는 실행옵션을 주는 방식이 약간 다른가보다.

아래와 같이 실행옵션을 쌍따옴표로 묶어 문자열임을 명시해주니 문제없이 실행됐다.

 

java -jar "-Dspring.profiles.active=prod" .\dev-dictionary-3.0.jar

 


© 2022. All rights reserved.