기본 브라우저에서 링크를 열려고합니다. 다음 코드를 사용했습니다.URISyntaxException 쿼리에 잘못된 문자가 있음
String myUrl = "http://www.example.com/engine/myProcessor.jsp?Type=A Type&Name=1100110&Char=!";
try {
Desktop.getDesktop().browse(new URI(myUrl));
} catch (IOException err) {
setTxtOutput("Error: "+err.getMessage());
} catch (URISyntaxException err) {
setTxtOutput("Error: "+err.getMessage());
} catch (Exception err) {
setTxtOutput("Error: "+err.getMessage());
}
나는 인덱스
에서 쿼리에 URISyntaxException 불법 문자를 얻고 나는이 때문에 같은 같은 문자의 생각?, & 및 ! 내 URL에 나는 다음과 같이 사용하려고 시도했다 :
URLEncoder.encode(myUrl, "UTF-8");
그러나 이것은 다른 오류를 준다.
Failed to open http%3A%2F%2Fwww.example.com%2F...........
The system cannot find the file specified.
당신은 어떻게 URISyntaxException 불법 문자 오류를 수정하는 방법 말해 줄 수주십시오.
예! 나는 공간을 % 20으로 바꿨고 지금은 작동합니다! 감사. –