I host my own webserver through Java. The problem is I can only access it through a web browser by using an ip address. Can I spoof a url? For example, I type in 192.168.2.111 into the address bar, I want this to switch to a url.
If you have a DNS server for you LAN, assign a name to the IP address in it. As you have listed a private IP address, you should not assign that address on an internet facing DNS server. Your DNS server will provide the IP address to any systems wanting to connect o your web server.
If you have only one or two systems that need to connect to the webserver, then is the hosts file would work perfectly well.
If you want connectivity from the internet, then you would use your IP address in an internet facing DNS server. You then need to configure your router to forward web traffic to the system running your webserver. It will likely be difficult to get this route to work inside your LAN.
Autoconfiguration can be be done by installing zeroconf the server and client. Both should register their names in the
local domain used by zeroconf.