java

Dev Platform of choice for Windows and OS X desktop apps

I'm about to write a small desktop app that should run on Windows and Mac OS X mainly. The choices I have so far are: I usually use Java + Swing for this type of stuff, but this app should be really tiny (about 1Mb) and I don't want to embed the ~26mb JRE on the Windows version or ask users to have it installed. I have good experience...

Problem with java not releasing oracle cursors.

Hi, I'm working on the following code below, (edited for clarity), that is giving me a few problems with open cursors in Oracle. Basically I am trying to select data from the DB and for each row returned there is 0 or more rows of sub data to be selected and appended to the record. This is currently being achieved by calling out to anot...

Can NetBeans generate an automatic serial version ID for a Java class?

I would like to remove some warnings for some classes by generating an automatic serial version ID. In Eclipse, this is trivial to do - the IDE can generate one automatically and add it to the class. However, I don't see this functionality in NetBeans. Is it available? If so, where is it? If not, is there a plugin that can enable it? ...

Snow Leopard QTJava Support

I am looking for information regarding support for QTJava on the latest Mac OS, 10.6. An application we are developing that worked fine both on 10.4 and 10.5 is now getting unexpected crashes on load when ran on 10.6. In the past we have had to strip out the 64bit architecture from the Java application stub because the QuickTime libr...

Is there a reason to use a real serialVersionUID?

This question is an exact duplicate of: http://stackoverflow.com/questions/888335/why-generate-long-serialversionuid Ironically, answered by Michael Bogswardt as well. Michael Bogswardt's answer to generating a serialVersionUID got me thinking. Is there any reason to generate a proper serialVersionUID like eclipse and IDEA (or j...

how to display custom error message in jsp for spring security auth exception

I want to display custom error message in jsp for spring security authentication exceptions. For wrong username or password, spring displays : Bad credentials what I need : Username/Password entered is incorrect. For user is disabled, spring displays : User is disabled what I need : Your account is diabled, please contact ad...

J2ME UI Screen Design

Are there any tools for UI screen design for mobile devices or Is most of the design done in a generic Image/DTP editing/creating software like MS Windows Paint or the likes? I found a few tools for creating sprite image filmstrips, like MotionWelder, However I haven't found any tools for UI screen design and am generally working in a...

How to receive what was sent by convertAndSend?

I'm reading Spring Framework reference, chapter about JMS integration. There are some examples for sending text messages and asynchronously receiving them (by listeners). And there is also an example for JmsTemplate function convertAndSend which converts given object to a message. The reference says: By using the converter, you and y...

Why does Java not support type inference for constructors?

E.G. to create an ArrayList of Strings we have to do something like List<String> list = new ArrayList<String>(); whereas it should be able to infer the parameter type for the constructor so that we only have to type List<String> list = new ArrayList(); Why can't the type be infered in the same way that type parameters are infered f...

How can I validate a JSON string against a schema programmatically?

Are there simple libraries out there (.NET and Java) that are able to validate a JSON string given a schema definition? It should work similar to how XML can be validated using XSD. EDIT: I need .NET and Java libraries. Thanks to darin for the .NET link! ...

Java: Use ObjectOutputStream without serializable

Hello, Sometimes, I want to use an ObjectOutputStream to write something to a file or sending a little image over the network. But BufferedImage and many other classes not implement java.io.Serializable and then the Stream cancels writing. Is there a way avoid that? Thanks, Martijn ...

Setting proxy in java, URL vs System.setProperty ?

I made an java app that gets a response time from the internet. I'm working from behind a proxy, now I have this problem that I can't figure out, here's a snipped of my code URL website = new URL("http", proxy, Integer.parseInt(proxyPort), websiteUrl) BufferedReader in = new BufferedReader(new InputStreamReader(website.openStream())); l...

Looking for space efficient algorithms and data structures

Preferably in Java. I am interested in implementations of data structures such as Sets and Maps, and algorithms such as sorting, that are memory-efficient, not necessarily fast. I could live with O(n^2) fetch and store if the amount of memory and number of allocations was low. Anything out there? ...

How to use a single checkstyle suppression file in Maven for all modules.

I have a project that consists of several Maven modules which are all children of a parent module. I have the parent set up to use checkstyle and the child modules all inherit this behaviour correctly. I would like all the child modules to use the parents suppression file defined in its plugin. I define a property checkstyle.suppression...

Finding list of versions available in a Maven repository for a specific plugin?

Given the following repository URL from my pom.xml how can I determine what the latest versions of spring and hibernate are available in the repository? http://repo1.maven.org/maven2 ...

Removing DOM nodes when traversing a NodeList

I'm about to delete certain elements in an XML document, using code like the following: NodeList nodes = ...; for (int i = 0; i < nodes.getLength(); i++) { Element e = (Element)nodes.item(i); if (certain criteria involving Element e) { e.getParentNode().removeChild(e); } } Will this interfere with proper traversal of the Nod...

One-arg Constructor A(x) implicitly invoking super() than super(x)

class A{ A(int x){} } class B extends A{ B(int x){} public static void main(String args[]){ B b = new B(10); } } I understand this would throw an error (one-arg constructor for B, implicitly calls super(), whereby no default-arg constructor exists for A). I am curious why one-arg constructor for B, does not...

Implementing Collections based (DDD) Repository with Hibernate

I'm trying to see if it's possible to implement a repository as a java.util.Collection (most likely a Map). Something along these lines: @Repository public abstract class HibernateRepository<K extends Serializable, V> extends AbstractMap<K, V> { @Autowired private SessionFactory sessionFactory; private Class<K> keyCla...

How to verify a jar signed with jarsigner programmatically

I'm wanting to sign a jar using jarsigner, then verify it using a Java application which does not have the signed jar as part of it's classpath (i.e. just using a filesystem location of the jar) Now my problem is getting the signature file out of the jar, is there a simple way to do this? I've had a play with the Inflater and Jar Input...

Disappearing jar entry when loading using SPI

So in my application I have a plugin system that I've written using SPI (service provider interface), so I have a jar file called scripts.jar that I keep somewhere (note: it's not on the classpath), then I load a script from it using this method: /** * Loads a script from the given name, regardless of case. * @param name script name ...