java

What changes can make serialized class versions incompatible?

I'm experimenting with the java serialization API to create small persistent objects. In my research I have found a lot on the importance of versioning, so you can detect and handle incompatible changes between the stored object model and the current object model. What I can't seem to find is what changes to the object model can actual...

Ant build fail - because ant forgets property?!

Hi I am getting the following build error- BUILD FAILED C:\eclipse\workspace\ContinuousTesting\build.xml:55: C:\eclipse\workspace\ContinuousTesting\${lib.dir} Here is the build.properties file: src.dir=./src build.dir=./bin lib.dir=./lib This is the whole task <target name="compile" depends="properties, create.build.dir, xm...

what is top down parsing ??

hello, i am an student need to implement an top down parser for my mini project i confident understand the concept and i read the Wikipedia article but still i have some doubts can any one explain about top down parsing and how to implement it with a small example... ...

Spring MVC: RESTful web services + BlazeDS integration possible in the same web application?

I have a Spring MVC web application which provides RESTful web services via a controller class (annotated with @Controller) which has methods mapped to specific request types and signatures via @RequestMapping annotations. I have attempted to integrate a BlazeDS service destination into the mix by 1) adding the HttpFlexSession listener ...

Find delta angle to use for rotation given entity with position, initial rotation and target point to 'face toward'

Hi, I'm coding a flocking algorithm in Java but I'm stuck at a certain point (using the Ardor3D libraries, in a 2D plane). Basically, I need to find the angle difference to add to the current rotation. If you can only get the way it should be pointing with polar coordinates with 0 degs at north and not the difference, not to worry -- I ...

BlackBerry: hang after delete calendar event during invoke calendar

I am developing for BlackBerry Bold 9700, using Eclipse Galileo. I am reading calendar events and calling calendar app to view and modify events via invoke. This is working fine so far, but while viewing or editing an event, if I press the BlackBerry button, and select delete, the calendar app hangs, but my app stays running. Even if I...

Is it possible to get "everything" from javax.naming.InitialContext?

Is it possible to retrieve "everything" (all names) from javax.naming.InitialContext? I didn't find any examples or documentation about it. ...

How to replace the image on JOptionPane dialog boxes on the title menu?

Instead of the default java logo, I want a different image on all my dialog boxes. The image is jpeg and already stored on my desktop. Is there a way to modify the title menu ? ...

While loop break condition

Hi, I want to do some calculations with polygons. So I need the user to input some x and y coordinates. This is performed by the following code: private static boolean isX = true; private static Scanner scanner = new Scanner(System.in); private static double readDouble() { double value = 0; System.out.print("Koordinate " + (is...

How to add an Image to a JPanel

I am trying to add an image to a JPanel class, which is a chess board. Then I want to be able to "cut" it to define each space as a part of an array list and then be able to place pieces on top of each according to the part of the board it is supposed to start in. Here is part of what I have: import javax.swing.*; import java.awt.*; im...

how to automatically copy values from java bean to protobuf message object using java reflection ?

Typically I could copy values between two java beans , which have identical property names, using beanutils with java reflection e.g. PropertyUtils.setProperty(....) In protobuf Message, we use the message builder class to set the value. This works but I would rather use reflection to automatically copy properties from the bean to the...

Which is the best way to access COM interfaces from a J2EE server?

Are the available Java-COM bridges like j-Integra, com4j and Jacob and others suitable to be used in a J2EE container? Which one is the most appropriate for that use? I need to evaluate the risk of JVM crashes, native memory leak and unmanaged thread creation (since it's not recommended in a J2EE container that uses thread pools) for the...

How to tame the X on the JOptionPane Dialog boxes?

Also, right now whenever I click the 'X" button on top right, the dialog boxes behaves as if I clicked OK (on messages) or YES (on questions). When the user clicks the X, I want DO_Nothing. In the code below, when i click on the X on the dialog box, it pops out the 'eat!'. Apparently, the X is acting as 'YES' Option, which it should no...

Trying to create spinning propeller. Keeps spinning around origin, not itself.

Hi. I'm trying to create a spinning airplane propeller in Java 3D. At the moment, it is rotating around the origin. However, I need it to rotate around itself. I haven't done much 3D graphics in Java, so I'm pretty much stumped. TransformGroup rotateTheBlades = new TransformGroup(); rotateTheBlades.setCapability(TransformGroup.ALLOW_TRA...

Strange behavior in Java, is it just me ?

I have the following lines : for (int i=0;i<3;i++) System.out.print("\nA : "+i); // System.out.println(""); // for (int i=0;i<3;i++) System.out.println("B : "+i); The output is : A : 0 A : 1 A : 2A : 2 Why ? I expected this : A : 0 A : 1 A : 2 But if I uncomment the 2nd and 3rd lines [ together or one at a time ], it b...

Minimum JARs for Spring 3.0 dependency injection

Similarly to this question regarding an earlier Spring version, what are the minimum dependencies required for an application to use Spring 3.0 dependency injection only? The application context will be configured by XML only. Spring depends on a logging framework, so assume I already include these JARs for logging: jcl-over-slf4j.ja...

How to have 2 Threads Talk To Each Other?

I'm currently making a IRC bot in Java (I know, there are frameworks out there) and I'm trying to have it connect to multiple servers. The problem I'm having with this is not the connecting part, I'm just running my Connect class in x amount of threads. Each thread will connect the bot to the server/port specified. Now my problem is that...

Java: merges two ordered list objects of integers into a single ordered-list

Write a program that merges two ordered list objects of integers into a single ordered-list object of integers. Method merge of class ListMerge should receive references to each of the list objects to be merged and return a reference to the merged list object ...

Java equivalent for MEF in .NET

Hi, Does the Netbeans Rich-Client Platform Development provide the same in Java as MEF in .NET? Is there is any other built-in easy way in JAVA to do pluggable applications? Thanks ...

Is there a good yaml library for Android?

Is there a java yaml library as good as snakeyaml for Android? (Or is anyone successfully using snakeyaml on Android already?) ...