이 두 문장으로 인해 표시된 예외가 발생하는 이유를 아는 사람이 있습니까?Runtime.exec에서 "시스템이 지정된 파일을 찾을 수 없습니다"는 원인은 무엇입니까? (assoc/ftype)
Runtime.getRuntime().exec("assoc .vlan=\"file type description\"");
Runtime.getRuntime().exec("ftype \"file type description\"=" + System.getProperty("user.home")+ "\\folder 1\\folder 2\\my executable.exe\" /inject \"%1\"");
그리고 여기 예외가 있습니다.
java.io.IOException: Cannot run program "assoc": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029)
at java.lang.Runtime.exec(Runtime.java:615)
at java.lang.Runtime.exec(Runtime.java:448)
at java.lang.Runtime.exec(Runtime.java:345)
좋아, 나는이 변경했지만 바로 그 명령을 실행하고 cmd 명령 프롬프트에서 작업 반면 여전히 연결이 이루어지지 않습니다.
Runtime.getRuntime().exec("cmd.exe /c assoc .vlan=\"file type description\"");
Runtime.getRuntime().exec("cmd.exe /c ftype \"file type description\"=\"" + System.getProperty("user.home") + "\\folder 1\\folder 2\\my executable.exe\" /inject \"%1\"");
무료 제안이 있습니까? 고맙습니다!
exec ("assoc .vlan = \"파일 형식 설명 \ "");'파일 연결을 만드는 경우 [Java Web Start] (http://stackoverflow.com/tags/java- web-start/info)는 앱에 대한 파일 연결을 추가 할 수 있습니다. 또한 Windows, OS X & * nix에서도이 작업을 수행 할 수 있습니다. [데모. ..demo 및 다운로드 할 수있는 소스에 대한 파일 서비스] (http://pscode.org/jws/api.html#fs). –