I am currently calling the following line of code:
java.net.URL connection_url = new java.net.URL("http://:/path");
and I get the exception above when it executes. Any ideas as to why this is happening?
解决方案
Your code works perfectly fine for me:
public static void main(String[] args) {
try {
java.net.URL connection_url = new java.net.URL("http://:/path");
System.out.println("Instantiated new URL: " + connection_url);
}
catch (MalformedURLException e) {
e.printStackTrace();
}
}
Instantiated new URL: http://:/path
Sure you have the right line of code?