java

Maven compile with multiple src directories

Is there a way to compile multiple java source directories in a single maven project? ...

Data structure for soundex algorithm?

Can anyone suggest me on what data structure to use for a soundex algorithm program? The language to be used is Java. If anybody has worked on this before in Java. The program should have these features: be able to read about 50,000 words should be able to read a word and return the related words having the same soundex I don't want t...

Recommended Java/AJAX design pattern?

Hi Folks, We need some input on what is a good design pattern on using AJAX in a Java application. Consider a simple scenario: User clicks a button which sends a request to a Java method to fetch data from DB. Java object is returned by method and needs to be converted into a HTML table. HTML table is shown on JSP. What we current...

Writing large strings with DataOutputStream

I've been doing some socket programming to transmit information across the wire. I've run into a problem with DataOutputStream.writeUTF(). It seems to allow strings of up to 64k but I have a few situations where I can run over this. Are there any good alternatives that support larger strings or do I need to roll my own? ...

LinkedList remove method

What is a doubly linked list's remove method? ...

Reading an email string from a cookie in java

Hello all, My application needs to store the users email address in a cookie so that I can pre-populate a login form (username == email address). I set the cookie value in JavaScript. If I read it from JavaScript, I get "[email protected]". If I look at it in the cookie viewer in Firefox I get "[email protected]". When I try to read it on the serv...

How to convert JspxIncludePathReferenceProvider for IntelliJ IDEA 8

I wrote an IntelliJ IDEA plugin for version 7.0 that uses JspxIncludePathReferenceProvider to allow autocomplete in a custom JSP tag (e.g. dsp:include src="/path/to/file.jsp"). The new version 8 of IntelliJ has changed the API for the Reference providers and I can't figure out how to convert this plugin for the new API. Any suggestions...

iterate static int values in java

Hello. I have a simple question. Is there a way ( using reflections I suppose ) to iterate all the static values of a class? For instance class Any { static int one = 1; static int two = 2; static int three = 3; public static void main( String [] args ) { for( int i : magicMethod( Any.class ) ){ ...

jetty - reload tag file in jar

Hi, I have my main web project and a common project which houses my tag files. Currently I use jetty in exploded structure and I jar up my common project with my tag files and place into web-inf/lib. When I make a change to my tag file, I can rejar and place into web-inf/lib again, though jetty is failing. javax.servlet.ServletExcepti...

What is the 'best' type of java.awt.image.BufferedImage?

I am creating a buffered image that is going to be a snapshot of a JComponent (via paint()) and rendered inside an ImageIcon. There are a large amount of types in the BufferedImage(int width, int height, int imageType) constructor, but which one should I use? I am sure that any of them would work, but which ones are better than the o...

CompositeData has no keys() method?

I'm using JMX to save some diagnostic information from a remote process. Looking at the interface in jconsole shows that the return type is CompositeData (the data actually comes back as CompositeDataSupport). I want to output all the key/value pairs that are associated with this object. The problem is that the interface just seems to h...

Why does my add method overwrite the Vector?

I am adding objects into a java Vector using its add(Object) method. In my example, the first 5 objects are identical, followed by 2 instances different from the first five. For some reasons, as soon as I insert the first one that is different, it changes the entire vector to that value! 'values' is an iterator containing something like...

Linking languages

Hi, I asked a question earlier about which language to use for an AI prototype. The consensus seemed to be that if I want it to be fast, I need to use a language like Java or C++, but that Python / Perl / Ruby would be good for the interface bits. So, this leads me on to another question. How easy is it to link these languages togethe...

Why System.setProperty() cannot change the classpath at run time !

I am refering to the question on changing the classpath programmatically. I read and found out that there is some function under System class as getproperties where we can retrieve the properties and then also can set it using setProperties(). The answers however I got was that It Wont work. I have not tried this myself, however, i am ...

Https WebService message: Message did not contain a valid Security Element

I am using axis 2 webservice client. The first https call to the webservice throws a exception with the message: "Message did not contain a valid Security Element". I think that the problem could be the security mode: maybe it has to be message level security. In this case, how can I configure it in axis?. The code: System.setPropert...

Locally declared variables can not be inspected

Sometimes when I am debugging code in Eclipse it happens that although I can see and inspect class member variables without any difficulty I am unable to inspect the values of variables declared locally within functions. As an aside, any parameters to the current function lose their 'real' names and instead one sees their values listed i...

How to avoid "!= null" statements in Java?

I work with java all day long. The most used idiom (code snippet) I'm programing in java, is to test if an object != null before I use it, to avoid a NullPointerException of course. But the code looks very ugly and becomes unreadable. Is there a good alternative to avoid this code snippet? Update: Pan, I was not clear with my question...

Cross-references and garbage collection

There is an application with an extensive object graph. This graph mainly consists of a set of subgraphs which are connected to the rest of the graph through the only reference. But internally each such subgraph has some number of cross-references among objects. Once in a while such a sub graph needs to be thrown away. Would it be enough...

How do I properly repackage the JRE installer in my installer?

I've got a Java application that I'm writing an installer for. We're using the AdvancedInstaller program to create our installer (well, we're evaluating it currently, but will definitely purchase a license soon), and although it has special support for Java applications, it is geared more towards repackaging them as desktop-type apps, a...

Multiple java versions running concurrently under Windows

We have a couple of applications running on Java 5 and would like now to bring in an application based on Java 6. Can both java versions live together under Windows? Is there any control panel to set the appropiate java version for different applications? ...