java

Best book/resource for learning Java design patterns?

I know the MVC design pattern but would be a little unclear about other Java design patterns, so I was just wondering if there's any useful books or other resources you could recommend to get up to speed with these patterns? ...

How to create a pluginable Java program?

I want to create a Java program that can be extended with plugins. How can I do that and where should I look for? I have a set of interfaces that the plugin must implement, and it should be in a jar. The program should watch for new jars in a relative (to the program) folder and registered them somehow. ...

Best Method to run a Java Application as a *nix Daemon or Windows Service?

I am looking for the best method to run a Java Application as a *NIX daemon or a Windows Service. I've looked in to the Java Service Wrapper, the Apache Commons project 'jsvc', and the Apache Commons project 'procrun'. So far, the Java Service Wrapper looks like it's the best option... but, I'm wondering if there are any other "Open So...

ASP.NET Master Pages equivalent in Java

What would be the Master Pages equivalent in the Java web development world? I've heard of Tiles, Tapestry and Velocity but don't know anything about them. Are they as easy to use as Master Pages? I want something as easy as set up one template and subsequent pages derive from the template and override content regions, similar to Ma...

Using Java to get OS-level system information

I'm currently building a Java app that could end up being run on many different platforms, but primarily variants of Solaris, Linux and Windows. Has anyone been able to successfully extract information such as the current disk space used, CPU utilisation and memory used in the underlying OS? What about just what the Java app itself is c...

Which Java DOM Wrapper is the Best or Most Popular?

I've used jdom in the past, and have looked briefly at XOM and DOM4j. Each seems to provide essentially the same thing, as they each provide a simplified wrapper over the (very obtuse) standard W3C DOM APIs. I know that JDOM went through some effort to develop a JSR and standardization process at one point, but as far as I know that ef...

Shutting down a computer using Java

Is there a way to shutdown a computer using a built-in Java method? ...

Java configuration framework

I'm in the process of weeding out all hardcoded values in a java library and was wondering what framework would be the best (in terms of zero- or close-to-zero configuration) to handle run-time configuration? I would prefer xml-based config-files, but it's not essential. Please do only reply if you have practical experience with a fram...

How can I play sound in Java?

I want to be able to play sound files in my program. Where should I look? ...

Book recommendation for Java good practices

After reading some Java beginners books and being comfortable with Java, what should I read next in order to write better/standard code? ...

IDE for Swing

Is there any IDE that simplifies creating Swing applications (ideally something along the lines of Visual Studio) ...

How to detect which blog API

Let's say that you want to create a dead simple BlogEditor and, one of your ideas, is to do what Live Writer does and ask only the URL of the persons Blog. How can you detect what type of blog is it? Basic detection can be done with the URL itself, such ashttp://myblog.blogger.com etc. But what if it's self hosted? I'm mostly intereste...

Previewing HTML in Java

What libraries/methods that you know of can do some basic HTML representation in Swing? Can you comment on your experience? ...

What HTML parsing libraries do you recommend in Java

I want to parse some HTML in order to find the values of some attributes/tags etc. What HTML parsers do you recommend? Any pros and cons? ...

Invalid <url-pattern> servlet mapping in tomcat 6.0

print("<pre><code><servlet> <servlet-name>myservlet</servlet-name> <servlet-class>workflow.WDispatcher</servlet-class> <load-on-startup>2</load-on-startup> </servlet> <servlet-mapping> <servlet-name>myservlet</servlet-name> <url-pattern>*NEXTEVENT*</url-pattern></servlet-mapping></code></pre>"); Above is the snippet form tomcat's w...

What is the general rule of thumbs for creating an Exception in Java?

I have been in both situations: Creating too much custom Exceptions Using too much the general Exception class In both cases the project started OK but soon became an overhead to maintain (and refactor). So what is the best practice regarding the creation of your own Exceptions? ...

Tool to read and display Java .class versions

Do any of you know of a tool that will search for .class files and then display their compiled versions? I know you can look at them individually in a hex editor but I have a lot of class files to look over (something in my giant application is compiling to Java6 for some reason). ...

Charting library for Java and .Net

Can anyone recommend a library for chart generation (bar charts, pie charts etc.) which runs on both Java and .Net? ...

Why aren't Enumerations Iterable?

In Java 5 and above you have the foreach loop, which works magically on anything that implements Iterable: for (Object o : list) { doStuff(o); } However, Enumerable still does not implement Iterable, meaning that do iterate over an Enumeration you must do the following: for(; e.hasMoreElements() ;) { doStuff(e.getNextElement()); ...

Generating gradients programatically?

Given 2 rgb colors and a rectangular area, I'd like to generate a basic linear gradient between the colors. I've done a quick search and the only thing I've been able to find is this blog entry, but the example code seems to be missing, or at least it was as of this posting. Anything helps, algorithms, code examples, whatever. This will ...