Java

Oracle Java in Linux - The easy way

Submitted by gunnar on

Since Oracle Java can no longer be available in the various Linux distributions, for licensing reasons, a number of more or less complicated guides have been written about how to install Oracle Java manually. This is another such guide, but less ambitious and hopefully easier to understand and use. It only describes how to install the JRE (the Java Runtime Environment), integrate it with Firefox and create a shortcut to the Java Control Panel.

Importing site certificate into Java Runtime certificate store

Submitted by gunnar on

When your Java program attempts to connect to a server that has an invalid or self signed certificate, such as an application server in a development environment, you may get the following exception:

javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

To make your Java runtime environment trust the certificate, you need to import it into the JRE certificate store.

A GUI Painter Friendly Table Component

Submitted by gunnar on

In the early days of Java, GUI forms were written, not drawn. They were created by writing code that instantiated components and added them to containers with various layout constraints. Then the program was run and the result could be admired. This way of working, WYGIWYG (what you get is what you get) was often quite fun, more often frustrating, and never very productive. Today we have a JavaBeans specification and integrated development environments (IDEs) with GUI painters.

Tags

Debugging bean customizers and property editors in NetBeans

Submitted by gunnar on

When you are developing GUI components you may want to create some nice bean customizers and property editors for them. But how do you debug them? The NetBeans developers may smile at this, knowing that there is a much better way, but I don't so smile away...

The trick is to start a new NetBeans instance in debugging mode. This is a built in feature of NetBeans module projects so we first need a simple NetBeans module. It doesn't have to do anything so you can create it in less than a minute using the New Project wizard:

Cherry Linux keyboard and Java

Submitted by gunnar on

Since I couldn't get the KeyMan utility that came with my Cherry keyboard to work with SuSE 10.3 I had problems getting the Cut, Copy and Paste keys to work. I tried using the KDE KHotKey service instead, and by defining input actions that map these keys to Ctrl+X, Ctrl+C and Ctrl+V I could use them in most applications.

Starting with Java 1.6 though, this isn't enough. Seems like Java can't handle mappings made for KHotKeys. To get the keys to work with Java applications I had to do two things:

Preventing remote access to datasources

Submitted by gunnar on

When you define a JDBC connection pool in Glassfish (AKA Sun Java System Application Server 9) and JDBC resources for it, you usually include a user name and password as pool properties.  You may think that this information is available only to deployed applications, but in fact anyone with IP access to the servers ORB port (3700 by default) can fetch the entire datasource definition using a simple JNDI lookup. If the database server is also accessible, then you have a security problem.

Using Apache as a proxy to access a J2EE web application

Submitted by gunnar on

OK, you have created a great web application and now you want to expose it to the world, or perhaps a limited subset of it. You probably don't want to allow full access to your application server so you need a proxy.

The apache proxy module (mod_proxy) can be used with a simple configuration like below:

<IfModule mod_proxy.c>