java

Java Reflection Performance

Does creating an object using reflection rather than calling the class constructor result in any significant performance differences? ...

ActiveMQ: Issue with queue lookup

I've set up a queue by configuring it in activemq.xml (ActiveMQ version 5.2.0) as described in the documentation. <destinations> <queue physicalName="FOO.BAR" /> <queue physicalName="DUMMY" /> </destinations> I'm trying to access it from java (on the same host) with the following code: Hashtable properties = new Hashtable(); ...

Are there good Java libraries that facilitate building command-line applications?

I need to write a simple command-line application in Java. It would be nice to use a library that takes care of parsing commands and takes care of things like flags and optional/mandatory parameters... UPDATE Something that has built-in TAB completion would be particularly great. ...

Find java classes implementing an interface

Some time ago, I came across a piece of code, that used some piece of standard java functionality to locate the classes that implemented a given interface. I know the the functions were hidden in some non logical place, but they could be used for other classes as the package name implied. Back then I did not need it, so I forgot about it...

Is there a way to have expander icons for multiple roots in a JTree?

I have a JTree with multiple "roots" (Of course, I actually have an invisible real root with multiple children). The nodes expand and collapse on double click, but there's no visual indication that you can do this as there is no expander icon. This is made worse by the fact that the tree is collapsed by default, but expanding the "root...

Has anyone successfully used signature timestamps in a java applet?

Java 1.5 added an enhancement to support signature timestamps. The idea, as far as I can tell, is that signed jar files should not become invalid just because the code signing certificate has expired, as long as the files were signed while the certificate was valid. In theory, this means we do not have to re-sign and redeploy our appli...

How do you add files to a jar using Netbeans 6.5?

I am working on a Java project using Netbeans for the first time. I would like to use Netbeans 6.5 to create a jar including about 50 text files. Is there a simple way to do this? ...

Events in Java?

I'm a bit confused from what I've heard Java doesn't do events. But I know that it does GUI events. Am I missing something? Does java have an event handling mechanism? I'm aware that I can implement a publisher subscriber pattern, but I'm lookign for native support within Java. I seem to remember something about Java Adding events in...

What is a good way to provide a different user experience based on the visitor type?

I am looking for a way to allow a Web application to provide a different user experience based on the type of visitor. For example, the same set of data should be presented differently to a child versus an adult. This is for a Java Web app. Just wanted to provide more clarification. What I am hoping for is any best practice for handli...

Facelets custom component doesn't set attribute after submit

I am having a problem with custom components in facelets. The first time that the page is rendered, the attributes are set properly on the component class. When a form is submitted however, the attributes are not set. Here is the class that I am using to test this. public class TestEcho extends UIData { /** Logger. */ private...

JSF Multiple Partial Validations Scenario

In JSF, is it possible to solve the following validation / updating scenario using the validation framework of JSF (aka validators, immediate, required, etc.)? +-- Form ----------------------------------------------------+ | | | Field A: |____________|v| ...

Java not inheriting accessor methods?

Given a class "Bar" that extends class "Foo" which implements interface "DeeDum" public interface DeeDum { public String getDee(); public String getDum(); } public class Foo implements DeeDum { public String dee = "D"; public String dum; public String getDee() { return dee; } public String getDum() { return dum...

Supporting Sessions Without Cookies in Tomcat

I am currently running an application with the following properties: Java-based with Spring and Acegi Running on Tomcat 5 I need the ability to support user sessions without cookies. Could someone please point me in the right direction. Thank you. ...

Storing MATLAB structs in Java objects

I'm using Java HashMap in MATLAB h = java.util.HashMap; And while strings, arrays and matrices works seemlessly with it h.put(5, 'test'); h.put(7, magic(4)); Structs do not h=java.util.HashMap; st.val = 7; h.put(7, st); ??? No method 'put' with matching signature found for class 'java.util.HashMap'. What would be the easiest...

Maven install folder structure problem j2ee (spring, struts ..)

Hi i'm using maven 2.1-SNAPSHOT as eclipse plugin. My project structure is like this: src/main/java    -model    -service    -action src/test/java    empty atm src/main/resources    empty atm src/test/resources    empty atm src/main/webapp    -js     -dojo    -META-INF    -WEB-INF      web.xml      appcontext.xml    ...

How to get data out of network packet data in Java

In C if you have a certain type of packet, what you generally do is define some struct and cast the char * into a pointer to the struct. After this you have direct programmatic access to all data fields in the network packet. Like so : struct rdp_header { int version; char serverId[20]; }; When you get a network packet you can do ...

JavaBeans Comparison

Hi, Does anyone know about a free open source library (utility class) which allows you to compare two instances of one Java bean and return a list/array of properties which values are different in those two instances? Please post a small sample. Cheers Tomas ...

Where can I download the source of "appframework.jar" that comes with NetBeans?

I have just started to try NetBeans. I created a new Java Desktop Application project, and it automatically added the JDesktop "appframework-1.0.3.jar" library. However, whenever I try to view its source, the command fails. I tried searching for it online, but I couldn't find it. So where can I download the source code for the "Swing App...

Verify certificate against Java certificate store via CLI

How can I verify an X509 (or DER-formatted) certificate against the Java certificate store via the command line? I've looked into using the keytool utility, but it looks like it only handles import/export/display functionality (no verification). EDIT: It looks as though keytool can be used for verification, but only if an import is at...

How does relative file path works in Eclipse.

So my 2009 new years resolution is to learn Java. I recently acquired "Java for Dummies" and have been following along with the demo code in the book by re-writing it using Eclipse. Anyway, every example in the book that uses a relative path does not seem to read the .txt file it's supposed to read from. Here is the sample code: impo...