java

recent posts related to java, jdbc, spring, etc.

A complete Java Ant Mac OS X Jarbundler build script

Java Mac application FAQ: Can you share a Java/Mac Ant build script that uses the Jarbundler task to make my Java application look like a native Mac OS X application?

I've written an awful lot over the last several years about how to build a Java application on a Mac OS X system so the application will look like a native Mac OS X application. I've even released some Ant build scripts to demonstrate how to build a Java application on Mac OS X using the Ant Jarbundler task.

Java on OS X - A free Mac/Java application to get the mouse cursor location and color

As I go through some old applications I wrote for various purposes, but never released, I thought I'd share the source code for a Java program that you can use to get the x/y coordinates or the mouse cursor (pointer) and RGB value of the pixel at that location. I've used this application for various reasons, including determining the location of something on screen, determining the width or height between two points, or getting the RGB value of a pixel on screen.

Java image cropping: How do I crop an image in Java?

Java image cropping FAQ: How do I crop an image in Java?

To crop an image in Java, just use the Java BufferedImage class, and specifically the getSubimage method of the BufferedImage class.

A collection of Java test projects and examples

Sigh, so many broken links, so little time ... when I switched this website to Drupal, I didn't (couldn't) take the time to move all of my static content in the Drupal CMS, so a lot of great content is just sitting out there in static files. To help fix that problem a little bit, here's a link to a collection of Java test project (example projects) that demonstrate all sorts of cool and fun things with Java, including:

Java file exists testing

Java "file exists" FAQ: How can I test to see if a file or directory exists in Java?

Java File exists method

To test to see if a file or directory exists, use the "exists" method of the Java File class, as shown here:

File varTmpDir = new File("/var/tmp");
boolean exists = varTmpDir.exists();

The Java File exists method returns true if the file or directory exists, and false otherwise.

A Java keytool certificate example - using keytool with certificate files

Java keytool FAQ: Can you share an example of how to use the Java keytool command to create and share a Java/keytool certificate?

Here's a quick look at how two people, John and Paul, might use the Java keytool command to create and share a certificate file. In this example, John will create the certificate with the "keytool genkey" and "keytool export" commands, and Paul will import John's public key from the certificate file with the "keytool import" command.

A Java "keytool export" tutorial

Java keytool export FAQ: Can you share some examples of the Java keytool export command and export process?

Once you've created a private key in a Java keystore file, you can export that private key to a certificate file using the Java "keytool export" command. I'll demonstrate that command in this tutorial.

keytool import - import a certificate into a keystore file

Java keytool import FAQ: Can you share some examples of the Java keytool import command and process?

When you're working with Java public and private keys, there may be a time when someone else says, "Here is a certificate. Import it into your public key keystore, and then you can do XYZ", where "XYZ" can be a variety of things, including reading their document, using their Java application, etc. To do this you need to use the Java keytool import command.

A Java keytool genkey example

Java keytool genkey FAQ: Can you share some examples of the Java keytool genkey command, and genkey process?

In my previous article on the Java keytool command, keystore files, and certificates, I demonstrated how to generate a private key with the keytool genkey option, but to simplify things a little, I thought I'd demonstrate the keytool genkey command again here by itself.

The Java keytool list command (the "Using keytool" series)

Java keytool list FAQ: Can you share some examples of the Java keytool list command, and Java keytool list process?

In a long, earlier article on Java keytool, keystore, and certificates, I demonstrated how to list the contents of a Java keystore file, but to simplify things a little for this tutorial, I'm just going to show how to query a Java keystore file using the keytool list command.

Syndicate content