java

implementing interfaces after the fact

I think, the following can't be done in Java. But I would be happy to learn how to implement something that resembles it. Suppose we have a class C, that is already used in compiled code. (We can neither change that code nor the original definition of C). Suppose further there is interesting code that could be re-used, if only C would ...

java Swing debugging headaches with Wacom pen tablet

I've been running up against a problem with Java Swing + my Wacom Graphire tablet for a few years in several Java applications and have now encountered it in my own. I use a pen tablet to get around wrist issues while clicking a mouse, and it works fine under Windows except when I'm using Java applications. In Java applications, the sin...

How to link to a package but only optionaly execute an action based on existence/availability of package at runtime?

From the perspective of a cross application/applet java accessibility service, how would you link to a package but only optionally execute an action based on existence/availability of a package (being already loaded) at runtime? I think what I'm interested in here is a way to resolve the class identity crisis but rather than the issue b...

Downsides to immutable objects in Java?

The advantages of immutable objects in Java seem clear: consistent state automatic thread safety simplicity You can favour immutability by using private final fields and constructor injection. But, what are the downsides to favouring immutable objects in Java? i.e. incompatibility with ORM or web presentation tools? Inflexible de...

load ActiveX object in Applet

Hi, I have a web application that processes events and audio received from a specialised microphone. The audio is processed by a Java applet that runs in the web page, but other events (microphone connected, microphone disconnected, microphone button pressed) are handled by an ActiveX object. The ActiveX object traps these events and c...

Google app engine JRE Class "Black List"

There is a "JRE Class White List" for the Google App Engine. What I would really like is a "Black List" -- in other words, Java APIs that will not work on GAE. Does such a list exist? Have any developers run into problems with Java APIs on GAE? ...

Running the same JUnit test case multiple time with different data.

Is there there any way to tell JUnit to run a specific test case multiple times with different data continuously before going on to the next test case? ...

java builds with different JDK versions : same artifacts?

here is my scenario: workstation A : Sun JDK 1.6 workstation B : Sun JDK 1.5 I build on A and B with Ant 1.7 <javac srcdir="${foo}" destdir="${bar}" source="1.5" target="1.5"> <include name="**/*.java"/> <exclude name="**/test/**/*.java"/> </javac> yet the .class files are different size on A & B, let alone CRC. is it suppose...

Set plugin's property on the command line in maven 2

In maven 2.x, how would one set a plugin's property on the command line instead of in the <configuration> of that plugin in the pom or in settings.xml? For example, if I was using mvn dependency:copy-dependencies(seen here) how can I set the useRepositoryLayout property without touching either the pom or my settings.xml? Thanks! ...

How to connect to HTTPS server using Common Access Card

I need to write a java program to connect to a HTTPS server (DoD website). The website requires CAC (DoD common access card) authentication. If you access this site via browser, you insert your CAC first, and then enter a PIN. I need to accomplish the authentication process programmatically in java (kind of acting like browser). How do ...

How do I handle multiple key press in java?

How do I handle multiple key press in java? I'm trying to write a game and need to handle multiple keys presses at once. When I'm holding a key (let's say to move forward) and then I hold another key (eg: to turn left), the new key is detected but the old pressed key isn't being detected anymore. ...

Homegrown utility methods

Static utility methods are generally frowned up by OO purists. I was wondering however what people feel about utility methods that are used to avoid something simple like a null check throughout the application. String.trim() throws a NPE when invoked on a null String. So I have to do: if(str!=null) setValue(str.trim()); else ...

RoR on GAE?

Since Google App Engine will soon full support Java: Would it be possible to run Ruby on Rails on Google App Engine? Or the limitations imposed by the AppEngine runtime will affect the JRuby implementation? What about other languages such as Groovy, Clojure, Scheme? Are there any effort to support .net and C# in JVM?? I think this wo...

What sort does Java Collections.sort(nodes) use?

I think it is MergeSort, which is O(n log n). However, the following output disagrees: -1,0000000099000391,0000000099000427 1,0000000099000427,0000000099000346 5,0000000099000391,0000000099000346 1,0000000099000427,0000000099000345 5,0000000099000391,0000000099000345 1,0000000099000346,0000000099000345 I am sorting a nodelist of 4 no...

Creating immutable objects from javabean

Hi All, I am involved in this project where we are building on good bit of legacy code. I have a particular situation about one big java bean object which has to be transferred over wire. So my first thought was to make it immutable and serializable to do the trick .At this point I am faced with a few difficult choices :- 1> Ideally ...

Binary Difference in Zip/Jar file

It seems like building a jar or zip from the exact same source files will always yield a different file. I tried this both using the java jar command, and the jar and zip tasks in ant. It appears to be due to the fact that new jars/zips have the timestamp set to the current time on each stored file. Is there a way to force a zip tool ...

JUnit test cases- setting up data

I have a simple CRUD operations that needs to be unit tested These test cases are for DAO layer- so all tests are against the database and hence cant be mocked. So I have one test cases for create another for update and another for read. 1) Should I hard code the data in the JUnit class or do you externalize it ? 2) The Read TestCase ...

JBoss Configuration

I have been tasked with setting up a server for running JBoss presumably the latest version. I was wondering if anyone had any recommendations for setting up the disk partitions for a Linux (Red Hat) system? Currently they are running the lab with everything on one partition, and I would like to avoid that going into production. Specif...

How can I use a custom bitmap for the "you are here" point in a MyLocationOverlay?

I've poured over the docs and haven't been able to figure this out. Is it even possible? Relevant documentation: http://developer.android.com/reference/com/google/android/maps/MyLocationOverlay.html ...

Passing variables to the Event Dispatch Thread

Hello, my GUI locks up because I need to update it through the EDT, however, I need to also pass a variable that is being updates with the GUI: while ((message = this.in.readLine()).startsWith("NUMPLAYERS")) { numOfPlayers = Integer.parseInt(message.split(":")[1]); numPlayers.setText("There are currently " + numOfPlayers + " pla...