java

Will Sun ever make the step to "Java 3"?

(Java 3 refers to theoretical post-Java-7 releases, remember: "Java SE was known as Java 2 Platform Standard Edition or J2SE from version 1.2 until version 1.5." That's why the name "Java 3" was chosen to refer to some future Java versions.) "Evolve and keep compatibility to old, deprecated APIs or redesign from scratch and loose all c...

ejb vs hibernate

When is better to use hibernate and when ejb3? Aren't there any impediments with either hibernate or ejb3? ...

Is it possible to code a device driver in Java?

Introduction I heard something about writing device drivers in Java (heard as in "with my ears", not from the internet) and was wondering... I always thought device drivers operated on an operating system level and thus must be written in the same language as the OS (thus mostly C I suppose) Questions Am I generally wrong with this a...

How to repack an Java Web Archive (WAR) ?

I have a .war file of an application. It works, but I need to update some inner jars (only minor version changes) While I can operate on .war archives using the midnight commander, the files can't be executed anymore: java.lang.SecurityException: SHA1 digest error. I tried repacking it using the jar command, but I get it wrong: The arc...

GUI, java, SWT and world map representation

Dear all, I'm trying to implement a small-scale strategy, taking turns game implemented in Java, GUI is made with JFace and SWT. My challenge is to write a GUI implementation of the world map, where countries will act as clickable buttons. However, countries have no fixed boundaries, no rectangular shape, and simply no way I can think...

Importing SSL Certificate into Eclipse

How do you import an SSL certificate created by java into a project in Eclipse? ...

What is the best way to read a comma delimited configuration file?

I have a comma delimited configuration file. The empty lines are ignored and there need to be errors on invalid lines: foo,bar foo2, bar3 I want to read this file into a HashMap where the key (foo) is mapped with a value (bar). What is the best way to do this? ...

How do I unify logging formats from the java stack

Using a Jetty web server, started from maven, which includes iBatis, Spring, Jersey, a little of this and a little of that, I get logging output with a host of formats. Some are from maven: [INFO] [war:war] [INFO] Exploding webapp... Some are from Jetty: 2009-03-25 21:01:27.781::INFO: jetty-6.1.15 2009-03-25 21:01:28.218:/example:I...

How can I search a graph for a path?

Say I have a list of edges each containing two nodes (to and from). What is the best way to find the edge two given nodes? Note that nodes in the edge may repeat. Say I have edge in this format: 1 <-> 5 3 <-> 7 5 <-> 6 2<-> 6 Then query such as 1 5 will return true. Then query such as 5 2 will return true because...

What data structure is most suitable for implementing a 2-D array in Java?

I want to implement a 2-D array kind of a thing. What data structure will be most suitable for this? An array or some other data-structure will do. If there is any other data structure which will satisfy my requirement, then please tell me. I don't want to use an array because the 2-D array needs to be declared early in the program but...

Dealing with KeyEvents in java.

Say I have a GUI, and I want the program to actually run when the spacebar is pressed, but if the spacebar is pressed again then I want the program to exit. Would something like this work? public class MouseClicker extends JApplet implements KeyListener{ int counter = 0; MouseClicker m1 = new MouseClicker(); //all of the other methods ...

Hashing function used in Java Language

Hi all I know that Java has beautiful inbuilt support for the HashMaps or HashTables. Does anybody have knowledge that what kind of hashing functions or techniques are employed by Java language? Is it possible to tweak those functions to be able to make them more specific to one's application in order to improve performance and redu...

Identifying 2 same images using Java

Hi all I have a problem in my web crawler where I am trying to retrieve images from a particular website. Problem is that often I see images that are exactly same but different in URL i.e. their address. Is there any Java library or utility that can identify if 2 images are exactly same in their content (i.e. at pixel level). My inp...

How can Hulu.com keep track of your position in a tv show?

I'm watching a tv show on Hulu.com (which is btw, the absolute best streaming-video site around) and whether I close my browser, disconnect from the internet, and even if I restart my computer in the middle of watching a show, the next time I go to their site, I can resume the tv from exactly the time where I left off in the show. My qu...

Eclipse builds ALL classes on each save

Hi, I have a large project in my workspace. Each time I save a jsp or any file (java, txt, properties etc.) the build runs. It takes about 30 to 45 secs to build. I hate it! I can't be productive like this. This just started happening recently, I've always had auto build enabled which didn't cause this issue. Other people here in the of...

Regular Expression (Java)

How do I match the following string? http://localhost:8080/MenuTest/index.action The regex should return true if it contains "MenuTest" in the above pattern. Cheers ...

SQLJ preprocessor not triggered

We develop our projects in Rational Software Architect (based on Eclipse 3.2) using SQLJ. Now every once in a while we notice that RSA marks an error on the SQLJ file, where in fact everything's fine. I.e. Only when I touch the file and let the IDE refresh it, it notices that the last generated sources are out of sync. It triggers the ...

Delivering json content to different browser types using restlet

We have developed a RESTful webservice using the restlet framework. The service is called by ajax requests using Prototype and/or Scriptaculous (I'm not familiar with those libraries, so excuse if any of these mentioned are not accurate). Everything seems to work for most of the popular browsers, i.e. Opera, Firefox, Safari all work fin...

Migrating from ant to maven in Netbeans

Our software is written in Java and comprise many (7) projects. These projects are Netbeans ant projects. I'm considering to converting them to maven2. Where can I find some hints for doing such thing? ...

Is there a standard closure interface that is Serializable?

If not, maybe you could tell me why. I get NotSerializableException when my class is being serialized. Inside the class I am passing this anonymous class to a method: new org.apache.commons.collections.Closure() { ... }; The question is still unanswered. I want to know if there is a standard Closure interface that implements Seri...