<p>I am currently calling the following line of code:</p>

<pre><code>java.net.URL connection_url = new java.net.URL("http://&lt;ip address&gt;:&lt;port&gt;/path");
</code></pre>

<p>and I get the exception above when it executes.  Any ideas as to why this is happening?</p>

[{'answer_id': 59851, 'author': 'jjnguy', 'author_id': 2598, 'author_profile': 'https://Stackoverflow.com/users/2598', 'pm_score': 2, 'selected': False, 'text': '<p>As a side note, you should be using <a href="http://java.sun.com/javase/6/docs/api/java/net/URI.html" rel="nofollow noreferrer">URI</a> because Java URL class is screwed up. (The equals method I believe)</p>\n'}, {'answer_id': 59864, 'author': 'sblundy', 'author_id': 4893, 'author_profile': 'https://Stackoverflow.com/users/4893', 'pm_score': 2, 'selected': False, 'text': '<p>That url string looks like it\'s invalid. Sure it\'s not supposed to be \'<a href="http://path" rel="nofollow noreferrer">http://path</a>\'? Or are the server &amp; port blank?</p>\n'}, {'answer_id': 59960, 'author': 'matt b', 'author_id': 4249, 'author_profile': 'https://Stackoverflow.com/users/4249', 'pm_score': 3, 'selected': True, 'text': '<p>Your code works perfectly fine for me:</p>\n\n<pre><code>public static void main(String[] args) {\n    try {\n        java.net.URL connection_url = new java.net.URL("http://:/path");\n        System.out.println("Instantiated new URL: " + connection_url);\n    }\n    catch (MalformedURLException e) {\n        e.printStackTrace();\n    }\n}\n</code></pre>\n\n<blockquote>\n  <p>Instantiated new URL: <a href="http://:/path" rel="nofollow noreferrer">http://:/path</a></p>\n</blockquote>\n\n<p>Sure you have the right line of code?</p>\n'}, {'answer_id': 7876198, 'author': 'Pavan', 'author_id': 1010917, 'author_profile': 'https://Stackoverflow.com/users/1010917', 'pm_score': 1, 'selected': False, 'text': '<p>I have also had the same exception, but in my case the URL which I was trying to execute had a space appended. After removing the space it worked fine for me. Check that the URL does not have any trailing spaces in your case.</p>\n'}, {'answer_id': 13266214, 'author': 'Jyoti', 'author_id': 1805539, 'author_profile': 'https://Stackoverflow.com/users/1805539', 'pm_score': 1, 'selected': False, 'text': '<p>I had the same error and it got resolved by the below :</p>\n\n<p>The jar files (JFree) which I added few days back got corrupted automatically and was causing this error. I downloaded the same files again from net and it worked fine for me.</p>\n'}]
['https://Stackoverflow.com/questions/59832', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/2328/']