java

Java inner class and static nested class

What is the main difference between a inner class and a static nested class in Java? Does design /implementation play a role in choosing any of these? ...

(no) Properties in Java?

So, I have willfully kept myself a Java n00b until recently, and my first real exposure brought about a minor shock: Java does not have C# style properties! Ok, I can live with that. However, I can also swear that I have seen property getter/setter code in Java in one codebase, but I cannot remember where. How was that achieved? Is ther...

Cheat single inheritance in Java !!

I have heard there is a way to cheat single inheritance and implement multiple inheritance in Java. Does anyone know how to implement this(with out using interface)? Just out of curiosity ;-) ...

How to conduct blackbox testing on an AJAX application?

What's the best, crossplatform way to perform blackbox tests on AJAX web applications? Ideally, the solution should have the following attributes: Able to integrate into a continuous integration build loop Cross platform so I you can run it on Windows laptops and Linux continuous integration servers Easy way to script the interactions...

Efficient way to implement singleton pattern in Java

Efficient way to implement singleton pattern in Java? ...

Packaging up Tomcat

Hi, In my job we have to deploy an application on various environments. It's a standard WAR file which needs a bit of configuration, deployed on Tomcat 6. Is there any way of creating a 'deployment package' with Tomcat so that you just extract it and it sets up Tomcat as well as your application? I'm not sure that creating a .zip file ...

Implements several interfaces with conflict in signatures

Lasty, I tried to implements an hybrid structure in Java, something that looks like: public class MapOfSet<K, V extends HasKey<K>> implements Set<V>, Map<K, Set<V>> Where HasKey is the following interface: public interface HasKey<K> { public K getKey(); } Unfortunately, there are some conflicts between methos signature of the S...

What is the best way to use Ext JS as part of Java / Spring / Hibernate based web application?

We want to try Ext JS on new project. Is there any well-known best practice for integrating Ext JS with server side Java (Spring/Hibernate/JS) application? Is DWR a good choice for that? ...

Extracting text from a PDF using JBoss Richfaces

I am trying to write a web-app to manage references for my PhD thesis. I used to manage this information inside a personal Confluence (fantastic tool! - http://www.atlassian.com/software/confluence/) instance however I'm fed-up with the opening of PDF's and cutting and pasting values into fields that I wish to record. I have exposed a ...

Hibernate mapping a composite key with null values

Hi, With Hibernate, can you create a composite ID where one of the columns you are mapping to the ID can have null values? This is to deal with a legacy table that has a unique key which can have null values but no primary key. I realise that I could just add a new primary key column to the table, but I'm wondering if there's any way ...

Algorithm to determine Daylight Saving Time of a date?

Originally I am looking for a solution in Actionscript. The point of this question is the algorithm, which detects the exact Minute, when a clock has to switch the Daylight Saving Time. So for example between the 25th and the 31th of October we have to check, if the actual date is a sunday, it is before or after 2 o'clock... ...

Hibernate (JPA) how to do an eager query, loading all child objects

Relating to my earlier question, I want to ensure all the child objects are loaded as I have a multiple threads that may need to access the data (and thus avoid lazy loading exceptions). I understand the way to do this is to use the "fetch" keyword in the query (EJB QL). Like this: select distinct o from Order o left join fetch o.orde...

Help in creating Zip files from .Net and reading them from Java

I'm trying to create a Zip file from .Net that can be read from Java code. I've used SharpZipLib to create the Zip file but also if the file generated is valid according to the CheckZip function of the #ZipLib library and can be successfully uncompressed via WinZip or WinRar I always get an error when trying to uncompress it using the J...

Can I add maven repositories in the command line?

I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like: mvn install -Dmaven.repository=http://example.com/maven2 The reason I want to do this is because I'm using a continuous integration tool where I have full control over the c...

Force Internet Explorer to use a specific Java Runtime Environment install?

When viewing someone else's webpage containing an applet, how can I force Internet Explorer 6.0 to use a a particular JRE when I have several installed? ...

OCSP command-line test tool?

Hi! Does anybody know of a tool to test OCSP responses? Preferably, something that can be used from a Windows Command-line and/or can be included (easily) in a Java/python program ...

Map of Enums and dependency injection in Spring 2.5

Let's assume we've got the following Java code: public class Maintainer { private Map<Enum, List<Listener>> map; public Maintainer() { this.map = new java.util.ConcurrentHashMap<Enum, List<Listener>>(); } public void addListener( Listener listener, Enum eventType ) { List<Listener> listeners; if( ( listen...

How do you grab a text from webpage (Java)?

I'm planning to write a simple J2SE application to aggregate information from multiple web sources. The most difficult part, I think, is extraction of meaningful information from web pages, if it isn't available as RSS or Atom feeds. For example, I might want to extract a list of questions from stackoverflow, but I absolutely don't need...

How to get parametrized Class instance

Since generics were introduced, Class is parametrized, so that List.class produces Class<List>. This is clear. What I am not able to figure out is how to get a instance of Class of type which is parametrized itself, i.e. Class<List<String>>. Like in this snippet: public class GenTest { static <T> T instantiate(Class<T> clazz) throw...

Why would a static inner interface be used in Java?

I have just found a static inner interface in our code-base. class Foo { public static interface Bar { /* snip */ } /* snip */ } I have never seen this before. The original developer is out of reach. Therefore I have to ask SO: What are the semantics behind a static interface? What would change, if I remove the st...