java

C# books for a Java Developer

I'm looking for a good language reference for C# 4.0 programming book. My programming languages background includes Java, C and perl. NB Please don't include books about ASP.NET, winforms, etc. ...

Is it possible to get all the subclasses of a class?

Possible Duplicate: How do you find all subclasses of a given class in Java? Hi, I would like to get a list of classes that implement an interface in Java at runtime so I can do a lookup service without having to hard code it. Is there a simple way of doing this? I fear not. Cheers, Cuvavu ...

When does Java's Thread.sleep throw InterruptedException?

When does Java's Thread.sleep throw InterruptedException? Is it safe to ignore it? I am not doing any multithreading. I just want to wait for a few seconds before retrying some operation. ...

Is there a way to replace the "openwith" name for java apps in windows?

i have a java app in windows, put in the registy the entries for the file extension and for the app. HKEY_CLASSES_ROOT/.xxx -> (Default)=xxxApp, Content Type=..., PerceivedType=... HKEY_CLASSES_ROOT/.xxx/OpenWithProgIDs -> (Default)=xxxApp HKEY_CLASSES_ROOT/.xxx/ShellNew -> command=c:\java... -jar xxxApp.jar and ItemName=xxxApp HKE...

Reference Data Pattern

Similar to this thread, but not exactly: How To Cache Information In A Threadsafe Manner What is the usual pattern for dealing with "reference data" - data that is frequently read by an application, usually externalized in a database or properties file, but updated very infrequently (days, weeks, months)? When the data is updated, it wo...

Can Spring and SWT work together for Java Desktop Applications?

Hi, I am going to design Java Desktop Application. While I was design web application, I got plenty of choice, e.g. Spring, Strut etc. However, for Java Desktop (which is new to me), I don't find any. Is that Eclipse RCP a Java Desktop Framework, which works like Spring mvc in Web apps? I wonder, can I use Spring to enjoy the benefit o...

Writing a formula to a cell with OpenXLS

I'm using Java and OpenXLS to write out an Excel spreadsheet. I want to set a formula for a cell but I haven't got a clue how to do it. Can anybody help me, please? :) (Can't tag this with "openxls" because I'm a new user...) ...

Java - Layout Manager Selection

Is there a simply layout manager I can use in a JPanel to create something akin to a bar chart? FlowLayout almost meets this need. The added component orientation needs to be left to right (default for FlowLayout), but they need to "rest" on the bottom of the panel with excess space at the top (not available in FlowLayout). Also, the com...

I'm writing a screen capture module in Java, but I'm having serious performance issues writing screenshots to disk. What else can I do?

I'm writing a screen capture module using the Robot class. I'm taking screenshots of the application every x milliseconds and writing them to disk. After screen capture is finished, I'm compiling the screenshots to video with FFMPEG. However, writing images to disk is extremely slow and grinds my application to a halt. What am I missing...

customize JMenuBar (e.g. BackgroundImage, highlighting color,...)

I'd like to adapt/customize the appearance of my JMenuBar, so i do a little research. Now i wondering why there are so little information about this issue?! I just found one good source here: http://forums.sun.com thread.jspa?messageID=4457769#4457769 which allows me to use a BackgroundImage for the MenuBar. The drawback is that i have ...

Automatic update of keyword in Word document

As part of our build process (java build with ant), I want to update a version number somehow in or near a Word document (software guide). "near" meaning I'd accept updating the document properties rather than something in the text itself. From looking around the internets, it looks like the main option is writing a small C# program tha...

JAXB: unmarshaling data on a per-instance basis

I am using JAXB to unmarshal an XML file into a Java object model. Works great, except for one thing. I've been using parseMethod and printMethod to convert simple strings to a type of my choice, e.g.: <someElement tag='Bismarck' name='Dagwood' /> <someElement tag='Pierre' name='Herb' /> where the "tag" attribute, instead of being unm...

Is there a Java library of Unix functions?

I am looking for a Java library to interface with standard Unix functions, i.e. stat(), getpwuid(), readlink(). This used to exist, and was called javaunix. It was released back in 2000. See this announcement. But the project page is now gone. Is there any modern replacement for these types of functions in Java today? One could mak...

Remoting and OSGi

Is there an elegant way to use Services across or between OSGi containers? Is it even possible? For instance, lets say I have a service interface on my local machine. What methodologies/technologies can I use to get that service interface accessible through a remote OSGi container's BundleContext? ...

What's wrong with using == to compare floats in Java?

According to this java.sun page == is the equality comparison operator for floating point numbers in Java. However, when I type this code: if(sectionID == currentSectionID) into my editor and run static analysis, I get: "JAVA0078 Floating point values compared with ==" What is wrong with using == to compare floating point...

Colours to PieChart in JFreeChart

I want to generate random colours which can be attractive in pie charts.I have a very poor sense when it comes to GUI.Can anyone help in writing a piece of function which generates 6 good colors that may look good in a pie chart in a random order.Right now I have hardcoded.But I don't like those colors.Please help me. plot.setSectionPai...

What should I look for when improving performance in Java?

I work in the maintenance team of a big project (around 7k+ classes) and my daily work is mainly to fix bugs. Sometimes, though, I have no bugs to work in. When this happens, I spent most of the time looking for performance gaps in the code. The fact that I have more than 7 thousand classes to look in means it's not obvious to find these...

What is the purpose of defining a package in java file?

i am newbie, and just learned that if i define say package my.first.group.here; ... then the java file that is in this package will be placed under my/first/group/here directory. What is the main purpose of putting some java files in a package? also, if i choose to adopt this, how should i group them? thank you EDIT: For any one...

Why doesn't this threaded network code work? (Java)

Code for server: http://stikked.com/view/64826511 Network Code for client: http://stikked.com/view/38974838 Basically, the client connects to the server, but beyond that, it does not work. When a message is sent, the client's System.out.println indicates that the GUI is calling the correct function. But there is no sign of the server...

Spring - How to call a method after bean initialization is complete?

Hi, I have a use case where I need to call a (non-static) method in the bean only-once at the ApplicationContext load up. Is it ok, if I use MethodInvokingFactoryBean for this? Or we have a some better solution? As a side note, I use ConfigContextLoaderListener to load the Application Context in web application. And want, that if bean ...