Java JFrame

Recently a co-worker said that he preferred to use Java over C# because he preferred not to be stuck under Microsoft’s thumb. This wasn’t a bad point and when he inadvertently reminded me that Java runs on Linux I thought I’d take another crack at using it. Now I have an option for a familiar, reasonably high-level language to run on my Ubuntu installation; I never could be bothered fiddling with the XAMARIN installations to get them to work.

With this I basically picked a task to have a go with Java and the Swing library. I think it’s pretty cool that these come built in with the JDK, so I had a great deal of fun creating this program but didn’t get nearly as much done as I’d have liked.

HTTPServer1

Figure 1. The program running on Windows

Screenshot from 2017-11-05 11-57-36

Figure 2. The program running on Ubuntu

Basically, I decided to build a simple server to respond to GET HTTP requests and send out any from a list of specified HTML pages. I’ve managed to do this by setting up a simple config file which specified the list of HTML files that can be retrieved and which to default to when the user doesn’t specify a page to load to.

HTTPServerPages

Figure 3. The contents box showing every file loaded in from the config box

As part and parcel of using any new technology I’ve gone and made some rookie mistakes: notably forgetting that the GUI wouldn’t scale properly when using a different resolution, and forgetting that the Linux systems have different line endings.

I realise this wasn’t much of a blog post; more a minor update as an example of what I’ve been doing. Hopefully, the next time I post one of these I’ll have something a bit more impressive to show off.