Unable to access jarfile Dspring.profiles.active=
in Debugging
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