java

Using C struct in Java

I have to code a Java program that will receive messages from network and display their content to the user. The problem is that the messages that I receive are simply binary dumps of C structures. Add to this some of the messages are coming from little endian machines and some from big endian without the fields being converted to networ...

Java API for processing of taxonomies

Looking for API that helps me with processing of taxonomies. It should be possible to work with taxonomy in object model (loading from xml file), list categories, traverse tree of categories (if it's tree taxonomy), getting name and value for category, etc. Read only mode is sufficient. Google hasn't helped a lot :( Usage can be as foll...

call valang validator in MultiActionController ModelAndView method... possible? how?

hello dudes. is this possible? i am basically making a Spring CRUD web app using MultiActionController class and would want my forms validated. i have used a SimpleUrlController before and valang works perfectly. ...

Converting Timer class from java to c#: scheduling tasks

I'm porting an application from Java to C# and I'm facing a problem connected to the different behaviors and features between the java.util.Timer and System.Threading.Timer. In fact, in the Java version of the Timer class there's a feature (used in the original code) for scheduling tasks, that is not present in the .NET version, where it...

A methology that allows for a single Java code base covering many different versions?

I work in a small shop where we have a LOT of legacy Cobol code and where a methology has been adopted to allow us to minimize forking and branching as much as possible. For a given release we have three levels: CORE - bottom layer, this code is common to all releases GROUP - optional code common to several customers. CUSTOMER - optio...

How do I detect whether the file system is case-sensitive?

I have a List<String> of file names from a folder and a certain file name as String. I want to detect whether the file name is in the list, but need to respect the underlying file system's property of whether it is case-sensitive. Is there any easy way to do this (other than the "hack" of checking System.getProperty("os.name", "").toLow...

Threading isolation in Java

Is there any sure-fire way to ensure Threads remain isolated from one-another, in Java? I've had an issue for a week and a half, where Threads implementing various 3rd party source code keep colliding due to static variables and other such things that are really beyond my control. I know a single system can run as many instances of the...

When is an ArrayList preferable to an array in Java?

When should I use an ArrayList in Java, and when should I use an array? ...

Java update on windows xp problem

I have JBOSS IDE 1.5(eclipse 3.x) on my windows xp computer and it works fine for years. Today when I tried to open JBOSS IDE 1.5, it give me following error when startup: JVM terminated. Exit code=2 C:\WINDOWS\system32\javaw.exe -Xmx512m -jar C:\eclipse\startup.jar -os win32 -ws win32 -arch x86 -launcher C:\eclipse\eclipse.exe -name E...

How to change JAVA.HOME for Eclipse/ANT

I am trying to sign a jar file using an ANT script. I know this has to be pointed at the JDK directory for jarsigner.exe to run, but when I echo java.home it returns the JRE directory. This isnt a problem for javac because I can set the executeable path, but that does not exist for signjar. How do I change the java.home path? When I ...

ThreadLocal when using hibernate session/JDO persistenceManager

I trying to understand the best prastice of using ThreadLocal for the above questions. From my understanding the reason of using this is to ensure only one session/pm created for entire application. My question is is there any impact of using threadlocal like this on clustering application? (example google app engine) ? if u use "trans...

CPP to Java conversion

Here's my scenario. I have an application written in C++ but not the complete source but the "meat" of it is there. I also have a compiled exe of this application. It communicates to a server somewhere here on our network. I am trying to replicate the C++ code in java, however it uses dwords and memory references, sizeof etc, all thi...

Targeting a Java app at Oracle AND Postgres

Does anyone have any experience with creating database agnostic apps in Java, particularly with Hibernate, and simultaneously targeting Oracle and Postgres databases? In particular I am looking at Oracle Spatial and PostGIS. We want to create a Java based SOA which can be used with both Oracle Spatial and PostGIS back ends. I've used Hi...

SwingBuilder: scrollPane

Hi, What's the proper way to set up a scroll pane using groovy's SwingBuilder? I'm using griffon and I'm having a hard time adding and removing components dynamically... Here's a snippet I've tried within SwingPad. It works ok, but the remove only take immediate effect if my scroll pane has scrollbars. If not, it takes 4-5 secs. Here'...

How to create custom object pools in Java application server

Suppose I have a message driven bean (MDB) in a Java application server. The MDB receives a message from a JMS queue and passes it to a message processor. In my case, a message processor is an extremely heavy weight object that requires extensive initialization so I don't want to create a new one to handle each message. Instead I would l...

What does it mean by "the hash table is open" in Java?

I was reading the Java api docs on Hashtable class and came across several questions. In the doc, it says "Note that the hash table is open: in the case of a "hash collision", a single bucket stores multiple entries, which must be searched sequentially. " I tried the following code myself Hashtable<String, Integer> me = new Hashtable<S...

Is JSR 296 (Swing Application Framework) stable enough to use? If not, what are the other options for small Swing apps?

Eclipse RCP and Netbeans Platform are too big for the smaller apps that I work on, but I would still like to use a framework to make my apps more maintainable and consistent. Are there any other small frameworks that would be useful here? ...

LinkedList<T> (2.0): removing items iteratively

Hi guys! I need to iterate through a LinkedList<T> (in .NET 2.0) and remove all the items according to a given criteria. It was easy way under Java, since I could do the following: Iterator<E> i = list.iterator(); while (i.hasNext()) { E e = i.next(); if (e == x) { // Found, so move it to the front, i.remove(); ...

What are the containers in Java

Could anyone please give me a brief full list of containers in Java? some of the ones I know are Array, Arraylist, Hashtable, HashMap, HatSet, Node, NodeList, TreeNode, TreeMap ...

Java: retrieve and replace the last line in a text file

What is the most efficient way of retrieving and replacing the last line of a text file (in Java 1.4) that could potentially contain millions of lines? Code examples I have seen so far have needed to iterate through the entire file line-by-line before determining if the last line was reached. A similar question was asked about replacing...