Advertisements

Articles about Java

The Java programming language is a popular object-oriented programming language that is used for creating many server and mobile applications in the world.

In this page, you will find articles relating to Java. Some of the topics include Java references, Java coding and Java application setup.

How to create a thumbnail of an image in Java without using external libraries

I had a situation when I wanted to display thumbnails of the images that my user had uploaded to my web application. A straightforward way could be to return the images in its entirety and use css techniques to scale down the image into a thumbnail. However, this is costly for my users who mainly access my web application from mobile devices.

One strategy for optimizing the web experiences of my users would be to generate the thumbnails at the server end so as to reduce the sizes of the HTTP responses that my server sends back to the mobile devices. And to reduce bloat from external libraries, I decided to use the facilities provided from Java standard libraries.

This post documents how I create a thumbnail from an image without using external Java libraries. For the sake of brevity, let’s assume that we had downloaded an image via HTTP GET from a web server and saved that image to the path /images/sample.jpg.

Advertisements

How to send HTTP GET request with Java without using any external libraries

There was this time when I need to build a program to check whether my web server is running fine. To determine that my web server is running fine, I wrote a Java applet that sends a HTTP GET to one of my web resources when the applet runs for the first time. And to keep the applet light, I look into Java in-built features for sending HTTP GETs to my server. This post documents a proof of concept that I did to communicate with my server endpoint via HTTP GET using Java in-built features.

How to send HTTP POST request with Java without using any external libraries

I need to create a Java solution that will be able to send some bulk processing information back to a HTTP server endpoint. The Java solution should be as lean as possible, using as many facilities that Java provides out of the box. Luckily for me, Java do provides the java.net.HttpURLConnection class for me to build my solution. This post details a proof of concept which I did to get to know more about the java.net.HttpURLConnection class.

In this proof of concept, I create a Java console program that will hit the php endpoint which I had created earlier to proof that I can use jQuery to push a dynamically generated file to the web browser based on the user’s input.

Why my Java applets took much longer to load when I upgrade to Java Runtime Environment version 7

I was looking after a couple of Java applets that are used in our private network for more than a decade. Changing business requirements mandated the upgrade of the Java Runtime Environment from version 1.5 to version 1.7. That change had caused my Java applets to load very slowly. On Java Runtime Environment version 1.7, my applets took at least 20 times longer to load.

How did this happen? Why did my Java applets took significantly longer to load when I upgraded my Java Runtime Environment to version 7? This post records how I had managed to solve the mystery and gotten my applets to run like they were on Java Runtime Environment 1.5.

Configurations that I set in my Java Control Panel to get my Java Plug-in to tell me more about the Java applets and binaries that it is running

Right after I took over the maintenance work for Java applets that are a decade old, I did an important tweak to my Java Runtime Environment: I applied some configurations for the Java Plug-in on my computer to be as verbose as possible when it had to run my Java applets.

This post shows how I had configured in my Java Control Panel in my windows machine for the sake of performing diagnostic tasks when trouble brews.