java.net.MalformedURLException: no protocol on URL based on a string modified with URLEncoder

后端 未结 5 947
终归单人心
终归单人心 2020-12-08 19:20

So I was attempting to use this String in a URL :-

http://site-test.com/Meetings/IC/DownloadDocument?meetingId=c21c905c-8359-4bd6-b864-844709e05754&item         


        
5条回答
  •  独厮守ぢ
    2020-12-08 20:18

    This code worked for me

    public static void main(String[] args) {
        try {
            java.net.URL myUr = new java.net.URL("http://path");
            System.out.println("Instantiated new URL: " + connection_url);
        }
        catch (MalformedURLException e) {
            e.printStackTrace();
        }
    }
    

    Instantiated new URL: http://path

提交回复
热议问题