Skip to content

Ways to save enums in database

What is the best way to save enums into a database? I know Java provides name() and valueOf() methods to convert enum values into a String and back. But are there any other (flexible) options to store these values? Is there a smart way to make enums into unique numbers (ordinal() is not safe to use)? Update T…

How to sanity check a date in Java

I find it curious that the most obvious way to create Date objects in Java has been deprecated and appears to have been “substituted” with a not so obvious to use lenient calendar. How do you check that a date, given as a combination of day, month, and year, is a valid date? For instance, 2008-02-…

Build Eclipse Java Project from Command Line

Is there a way to compile an Eclipse-based Java project from the command line? I’m trying to automate my build (using FinalBuilder not ant), and I’m neither a Java nor Eclipse expert. I can probably figure out how to do this with straight java command line options, but then the Eclipse project fee…

What is the proper way to store app’s conf data in Java?

Where do you store user-specific and machine-specific runtime configuration data for J2SE application? (For example, C:UsersUSERNAMEAppDataRoaming</em> on Windows and /home/username on Unix) How do you get these locations in the filesystem in platform-independent way? Answer That depends on your kind of…

How to upgrade JRE

Is there anyway to upgrade the installed JRE in the system? We are having 1.5.0_08 installed in out HP Unix system.We have to upgrade this to 1.5.0_15.Is there a way to patch up the existing JRE and upgrade to a newer version.Or can this only be achieved by installing the newer JRE and set this in the system …