The exception tells us, that it is using the hostname and the local part as the (unknown) host. This looks like you have constructing the URL incorrectly. Maybe you forgot to use http://
prefix or used the wrong getters? You can debug it by calling baseURL.getHost()
, baseURL.getPath()
and baseURL.getProtocol()
to see if it returns cs.uwec.edu
and /~steve...
and http
.
I just noticed you added the baseURL with new URL("HTTP", "cs.uwec.edu/~stevende/cs145testpages/", theHREF)
this is wrong, you need to use new URL("http", "cs.uwec.edu", 80, "/~stevende/cs145testpages/#"+theHREF)
. You can however typically skip the anchor/ref, as it will not transmitted to the server.
You can also use the single argument constructor new URL("http://cs.uwec.edu//~stevende/cs145testpages/")
.