java

Annotations of Annotations in Java 5/6

I am setting up Hibernate Caching and want to cache certain entities in different regions. For example, some entities can be "stale" for up to 5 minutes, some for an hour, and some (like lookups) won't change for weeks. To facilitate easy config of regions in my code, I'm trying the following: I created an annotation named @LookupCache ...

Why do several java.util.List methods not use the type parameter?

Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic This is similar to the question here, on java.util.Map. This question is left as a pointer to that question. The List interface contains several methods which still accept an Object as parameter, after generics were introduced in Java 5. S...

What should I do for separating a string?

For example I have a string "1234" that I want to break into two strings "12", "34". Is there any method for doing that? How? ...

Difference between mouseListener and mouseMotionListener in Java?

Is mouseMotionListener going to trigger an event once the mouse moves over the component, whereas mouseListener only triggers if I press a button? So if I have only a mousePressed event, then I don't need a mouseMotionListener? Only if I had a mouseEntered or mouseExited? ...

Multi-Dimensional Container in Java

I searched around on Google, but I was unable to find any libraries for a multi-dimensional container in Java (preferably one that supports generics as well). I could easily write one (in fact, I have started to), but I was hoping that I would be able to reuse the work someone else has done for the sake of efficiency. I don't necessari...

ASM jar - Why my java project has a dependency on this?

I have a Java project and internally it is dependent on asm jar. Strangely, I don't even know why my project somehow is dependent on this library (might be brought in by maven as a transitive dependency)? Can anyone help me know why some one needs asm jar? Thanks in advance ! EDIT: Can you also mention for what purposes/use-cases one ...

Where can I download source code for Java SE (java.lang, java.util, &c.)?

I have no problems finding JREs, JDKs and documentation for core Java SE packages, but I'm not sure where to get the source (.java) files. I'm looking for the latest stable release, not bleeding-edge development code. Where are those available? ...

signed java applet restrictions?

I wrote a java applet and self signed it. When I run it in eclipse or as a executable jar it works fine. But when I upload it, it doesn't do anything. It loads, and the self signed cert warning does come up and I click yes but nothing. I was under the impression that signed applets had no restrictions. What could be the problem? ...

How to suppress the keystore password prompt when using Java Webstart with client auth?

Is there a way to suppress the password prompt when using Java Webstart with a https server that uses client authentication? I would like to do this, because the webstarted app runs on a touch screen device that got no keyboard and runs in a kiosk mode. Therefore it would be sufficient to either remove the password from the keystore or t...

Do any Java GUI builders exist that do not require external JAR's?

I am looking for a Java GUI building tool that generates the Java Swing code for me. I'm planning on using it to get all of the Frame/Panel code created quickly and then customize everything by hand after that. It would be nice to be able to choose between different layout managers, but it's not necessarily required. The most importan...

Java - appending to Excel file with FileOutputStream

This code appends to an already created Excel file: FileOutputStream fileOut = new FileOutputStream("c:\\Decrypted.xls"); What can we add / modify so that Decrypted.xls should be created if not already created and appended if already created? ...

Closures in Java - syntax differences between the three major proposals?

Three major proposals for adding closures to the Java language has been presented: BGGA (Bracha Gafter Gosling Ahé) also known as "full closures", by Gilad Bracha, Neal Gafter, James Gosling and Peter von der Ahé CICE (Concise Instance Creation Expressions) also known as "simplified inner classes", by Bob Lee, Doug Lea and Josh Bloch F...

Finding the version of OSX inside java

I need to test if the version of osx is < 10.5 inside java is this possible? ...

Using Spring managed DAO without controller?

Hello, I'm trying to get my Portlets work with some DAO Objects which I configured as spring beans. I've included an application.xml to my WEB-INF, added it to my web.xml, configured hibernater support, a datasource. Everything seems fine, after deployment I see the context loaded message from spring. Now I'm trying to get one dao objec...

loading BufferedImage with ClassLoader.getResource()

Hello, I am trying to load an image file (gif) which is stored locally in the same directory as my Eclipse java project: ref is the relative path where the gif image is stored. public Sprite getSprite(String ref) { BufferedImage sourceImage = null; try { URL url = this.getClass().getClassLoader().getResource(ref); ...

Missing numbers in the outputstream ( with Complete Details )

( To moderators - This is the 3rd related post of still unsolved problem , now i am posting with all details possible and after doing changes from previous post feedback , though this is a complete post and not dependent on previous 2 posts , if you think this is duplicate please delete the previous posts. thanks ) This is the code of t...

Java catch blocks use static binding?

Assume InvalidResourceException is a subclass of ResourceException. Define two methods: void handleException(ResourceException e) { System.out.println("ResourceException " + e.toString()); } void handleException(InvalidResourceException e) { System.out.println("InvalidResourceException " + e.toString()); } Now the following code:...

display the unicode value in the java screen

how to display non english words with unicode in java? "\u0905\u092E\u0940\u0924\u093E\u092A" i have to display this ib Hindi? ...

When should and shouldn't you break away from OOP for speed/performance?

In their developer articles for Android, Google states that you should usually declare public variables rather than private ones with getters and setters to enhance performance on embedded devices (I suppose function calls are more expensive than just writing to an address). I was wondering - to what extent should performance be sacrif...

Using Protocol buffer as general Data object?

We're introducing protocol buffers as the new transport for some back end RPC services. Because there's resistance to manually shuttling data between different forms of similar objects, I can forsee the Protocol Buffer instances being passed up the stack a bit higher than just to the RPC server interface. Is this something that I shoul...