java

A good tutorial on building Eclipse plugins?

I'm trying to get started with my first Eclipse plugin, but can't seem to find a good tutorial on the subject that is newer than 2003, when Eclipse 2.1 was in style. Any pointers on finding a quality tutorial that is still relevant? ...

Is it worth becoming Sun Certified?

Hi all, I am a developer of about 2 years, who is looking to progress my career. I've mainly worked with Java up to now on various projects, and was considering trying to take the Sun Certified Java Programmer / Developer exams. Are these a useful thing to have on my CV and what are people's experience of them? Any opinions would be we...

Is it possible to make eclipse generate hashCode and equals with HashCodeBuilder and EqualsBuilder

The default generated hashCode and equals implementations are ugly at best. Is it possible to make eclipse generate ones from HashCodeBuilder and EqualsBuilder, and perhaps even a toString with ToStringBuilder? ...

Java volatile reference vs. AtomicReference

Is there any difference between a volatile Object reference and AtomicReference in case I would just use get() and set()-methods from AtomicReference? ...

Castor compilation of schema produces different class hierarchy depending on elements in schema.

While mataining a castor based system, I amend the source schema to produce a new set of classes and find that introducing a new element produces a different class hierarchy. This is true of any element type. Briefly, the current schema creates class foo which extends fooParent which extends fooGrandparent. Introduce a new element in t...

Which Java GUI framework to choose now?

Which GUI framework/library would you choose if you were to start your new project now or in the near future? It has to be free for commercial use and cross platform. I have been a happy swing user, but Sun seems like pushing swing to deprecation, while pushing Javafx, which is not yet ready for prime time. There's also SWT, but it se...

Java to C# Conversion

I need to convert several Java classes to C#, but I have faced few problems. In Java I have following class hierarchy: public abstract class AbstractObject { public String getId() { return id; } } public class ConcreteObject extends AbstractObject { public void setId(String id) { this.id= id; } } The...

Jlabel HTML formatting

I have a JLabel which has an e-mail address in it. I used HTML formatting on the JLabel, so it appears as a link. However, you are not able to click the link. In fact, you cannot select any of the text in the label. Is there a property that I can set on the JLabel to allow the user to at least select the text of the e-mail, and preferabl...

What do I need to write Java-based web applications and test them on my personal computer?

I currently have Apache HTTP Server, but I'm guessing I'll need Tomcat (and then have to configure it in a way that makes it not open to the public), a Java JDK (which I already have, but should probably update), and an IDE (I have Eclipse). But what else should I have or know before starting? ...

JPA mapping interfaces

Hello All I am having trouble creating a mapping when the List type is an interface. It looks like I need to create an abstract class and use the discriminator column is this the case? I would rather not have to as the abstract class will just contain an abstract method and I would rather just keep the interface. I have an interface le...

Tiff compression using Java ImageIO

I am having issues converting a png to tiff. The conversion goes fine, but the image is huge. I think the issue is that I am not doing the compression correctly? Anyone have any suggestions?? Here is the code sample public static void test() throws IOException { // String fileName = "4958813_1"; String fileName = "4848970_1"; St...

How good is FreeBSD as a development platform?

I know that lots of web hosting providers are offering FreeBSD, but how good is FreeBSD as a development platform? Specifically, is Java 1.6 available in it? Is there somthing specific that it offers with regard to tools that is not available under Linux? ...

Best way to modularize a block of JSP code

I have a block of JSP code that needs to be used in several places (basically a widget that several pages use). What's a good way to modularize this? I'd rather not put it in an object since string manipulation of HTML gets ugly. Using <%@ include file="foo.jsp"%> is problematic because we wind up having implicit global vars. ...

Prepared statement pooling in dbcp

Can someone explain how exactly prepared connection pooling using dbcp can be used? (with some example code if possible). I've figured out how to turn it on - passing a KeyedObjectPoolFactory to the PoolableConnectionFactory. But how should the specific prepared statements be defined after that? Right now, I'm only using a PoolingDataSo...

Unit tests vs integration tests with Spring

I'm working on a Spring MVC project, and I have unit tests for all of the various components in the source tree. For example, if I have a controller HomeController, which needs to have a LoginService injected into it, then in my unit test HomeControllerTest I simply instantiate the object as normal (outside of Spring) and inject the pro...

What is the rationale of SwingWorker?

For what I can read, it is used to dispatch a new thread in a swing app to perform some "background" work, but what's the benefit from using this rather than a "normal" thread? Is not the same using a new Thread and when it finish invoke some GUI method using SwingUtilities.invokeLater?... What am I missing here? http://en.wikipedia....

How can I change the database schema using a Statement.execute() in Java ( and SQL Server)?

I need to execute a SQL Server system stored procedure, programmatically, and since it executes in the current schema, I need to change it on the fly. Like this Statement st = connection.createStatement(); st.execute("EXEC SP_ADDUSER ' ', ' '"); But SP_ADDUSER only executes on the current schema set for the connection, so if I wanted ...

How to rewrite this block of code using a StringBuilder in Java?

Given a word, I've to replace some specific alphabets with some specific letters such as 1 for a, 5 for b etc. I'm using regex for this. I understand that StringBuilder is the best way to deal with this problem as I'm doing a lot of string manipulations. Here is what I'm doing: String word = "foobooandfoo"; String converted = ""; conver...

Audit Schema Mapping with Hibernate and AOP

Hi, I am trying to audit the action that the user performed that resulted in changes to corresponding tables. For example if a user were to transfer money between 2 accounts this would generate the following sequence of events: Insert transfer amount into Transfer table Subtract transfer amount from balance in Balance Table for Accoun...

Importing and using external schema using XML Beans

Hello, I have a bit of a problem. I wrote an API a long time ago for our production system, and it used Apache XML Beans. The schema was homogeneous (ie no imports, everything was from within the same schema), and everything worked just fine, even if the code for API handling was incredibly verbose. I've since written a far simpler a...