java

Java equivalent to app.config?

Is there a Java equivalent to .NET's App.Config? If not is there a standard way to keep you application settings, so that they can be changed after an app has been distributed? ...

Is there a good way to have a Map<String, ?> get and put ignore case?

Is there a good way to have a Map get and put ignore case? ...

getResultSet from Spring-JDBC

Hi, I'm using Spring's support for JDBC. I'd like to use JdbcTemplate (or SimpleJdbcTemplate) to execute a query and obtain the result as an instance of ResultSet. The only way that I can see of achieving this is using: String sql = "select * from...."; SqlRowSet results = jdbcTemplate.queryForRowSet(sql); ((ResultSetWrappingSqlRowSet...

How do you create a PDF from XML in Java?

At the moment, I'm creating an XML file in Java and displaying it in a JSP page by transforming it with XSL/XSLT. Now I need to take that XML file and display the same information in a PDF. Is there a way I can do this by using some kind of XSL file? I've seen the iText Java-PDF library, but I can't find any way to use it with XML and a...

Should a method that implements an interface method be annotated with @Override

Intro My real question is about the use of the annotation. Trying to find an answer myself, I ran into several other questions. This is why there are also related questions below. I hope this is not too confusing. Question Should a method that implements an interface method be annotated with @Override? Eclipse for instance automatical...

Which log4j Version is bundled with latest OpenCms 7?

Which log4j Version is bundled with latest OpenCms 7? ...

How do you reduce Java logging boilerplate code?

Every class that wants to use java.util.logging generally needs to declare a logger like this: public class MyClass { private static Logger _log = Logger.getLogger(MyClass.class.getName()); } How do you avoid this MyClass.class.getName() boilerplate code? ...

In Java, how do I dynamically determine the type of an array?

Object o = new Long[0] System.out.println( o.getClass().isArray() ) System.out.println( o.getClass().getName() ) Class ofArray = ??? Running the first 3 lines emits; true [Ljava.lang.Long; How do I get ??? to be type long? I could parse the string and do a Class.forname(), but thats grotty. What's the easy way? ...

How do I center a JDialog on screen?

How do I go about positioning a JDialog at the center of the screen? ...

Inter-plugin communication in Eclipse

Is it possible to create Eclipse plugins that auto-discover eachother? I am developing a set of plugins that need to operate in two primary situations: individually in concert with each other. When run individually, the plugins should "just work" but when in concert, they will be sharing some of the same model content, and one of th...

Open-source improvements or replacements for Swing components

I develop a number of desktop Java applications using Swing, and while Swing is quite powerful (once you get the hang of it), there are still a lot of cases where I wish some advanced component was available right out of the box. For example, I'd really like to see easy-to-use components (without writing them myself, which I could do gi...

java.net.URLEncoder.encode(String) is deprecated, what should I use instead?

I get the following warning when using java.net.URLEncoder.encode: warning: [deprecation] encode(java.lang.String) in java.net.URLEncoder has been deprecated What should I be using instead? ...

Storing arrays in databases

What is the most efficient way to store large arrays (10000x100) in a database, say, hsqldb? I need to do this for a certain math program that I'm writing in java. Please help. The whole array will be retrieved and stored often (not so much individual elements). Also, some meta-data about the array needs to be stored about the array. ...

Why do people use Java?

I've become very curious lately, what is it about Java that made it so popular? I've avoided learning it in detail because it seems like a very poor language at a very basic level. A good language should make simple operations simple (not too much boilerplate to do something simple and common like loop over a collection, create a helpe...

AIX: IBM Java: java.net.SocketException: Connection timed out:could be due to invalid address

We have seen the following exceptions very frequently on IBM AIX when attempting to make an SSL connection to our server: java.net.SocketException: Socket closed at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275(Compiled Code)) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275(Compiled Code)) at java.io.BufferedO...

Learning j2ee, jboss, etc.

I've been doing "plain old java objects" programming for 10 years now, with Swing and JDBC, and I consider myself pretty good at it. But I start a new job in two weeks where they use JBoss, and I'd like to get a heads up and start learning all this stuff before I start. What are good resources? On-line tutorials, books, e-books, anyth...

New features in java 7

What new features in java 7 is going to be implemented? And what are they doing now? ...

Is making an empty string constant worth it?

I have a cow-orker that swears by //in a singleton "Constants" class public static final String EMPTY_STRING = ""; in a constants class available throughout the project. That way, we can write something like if (Constants.EMPTY_STRING.equals(otherString)) { ... } instead of if ("".equals(otherString)) { ... } I say it's...

Best table / enum driven method calling system

Consider I'm interfacing with an external system that will send a message (DB table, message queue, web service) in some format. In the "message header" there is the "MessageType" that is a number from 1 to 20. The MessageType defines what to do with the rest of the message. There are things like new, modified, deleted, canceled... M...

Velocity #parse but assign it to a variable

Say you have a standard template with included (parsed) header, body, footer templates. In the body template a variable like $subject is defined and you want that also displayed in the header template. In some other template languages like HTML::Mason(perl based) you would evaluate the body template first to pick up the $subject variab...