java

How to reschedule a task using a ScheduledExecutorService?

I saw this in the java docs: ScheduledAtFixedRate, it says If any execution of the task encounters an exception, subsequent executions are suppressed I don't want this to happen in my application. Even if I see an exception I would always want the subsequent executions to occur and continue. How can I get this behavior from Sc...

Trying to use String.split() regex on String created with Formatter

Hi All I am a newcomer here, I am using the following code from an open source library (Matrix Toolkits for Java) which outputs the following matrix 1000 1000 5 3 5 1.000000000000e+00 I am trying to do a String split that will return me 1000,1000,5 I tried using String[] parts = str.trim()...

Scheduler using Thread Pool & Priority Queue?

I'm gonna implement a scheduler using thread pool & priority queue in Java and I want to ask whether anybody knows any existing implementations or not, so I don't have spend time on it :-)... Basically, the ScheduledThreadPoolExecutor in java.util.concurrent package provides almost functions I need except the "priority queue". As I roug...

Not able to highlight the file in JTree

Hi, I have created a JTree in which I want to highlight a file and if the directory containing the file is invisible, I need to expand it. Ex: I have created a JTree with the root node- D:/Company/abb/src. The file which I want to highlight is - D:/Company/abb/src/bin/help.txt Please give me some logic to highlight the file help.txt. ...

Continuous build with .NET and Java projects on a single machine

Is it possible to set up continuous build of projects written in .NET and Java on single build server with single set of applications? I've seen CruiseControl has support for both world but as far as I know these are two separate applications. Should I go with a separate machine to build Java projects (a machine for .NET projects is alr...

Java VNC Applet vs Screen Capture

Hi, I am trying to make an application in which one component captures the screen of the user (for screen casting). I am aware that there are two options to achieve the same using a Java applet (please correct me if I am wrong). First is to use the java applet to take screen shots continuously and convert it into a video and upload it a...

What Java embedded VM do you suggest for ARM development?

There are a lot of Java embedded VMs. What do you suggest for ARM development? http://www.cacaovm.org/ http://www.rtjcom.com/main.php?p=home http://www.k-embedded-java.com/ http://jamvm.sourceforge.net/ I'm currently using the TINI platform from Dallas and works great (512 KB RAM and 1 MB flash), but now I need more power (memory and ...

Java: Creating a subclass object from a parent object

Newbie Java question. Say I have: public class Car{ ... } public class Truck extends Car{ ... } Suppose I already have a Car object, how do I create a new Truck object from this Car object, so that all the values of the Car object is copied into my new Truck object? Ideally I could do something like this: Car c = new Car(); /* ....

How do I best catch up with the latest developments in java?

I am applying for a job as java developer. I programmed some hobby apps in java until 2001, after that I have mostly worked in c++ and other languages. Meanwhile, it feels like java has grown a lot, and there are all kinds of acronyms (EJB, spring, etc) unknown to me. Where can I find a concise, clear explanation of the recent (5 years...

Is it worth moving from Java to C#, for someone with 3 years of Java experience?

Hi All, I have been working on java/J2ee for the past 3 years. My job included working on JSF and Axis web services and a bit of hibernate too. The IDE that i use is eclipse, with project mgmt tool as ant/maven and JBOSS as my application server. Because of this recession, I have been asked to move to a new team that develops software on...

Discover from a batch file where is Java installed?

I want to set the JAVA_HOME variable from a batch script ...

Best way to use an InputStream regarding persistance and XML

Hi, I have a REST webservice that listens to POST requests and grabs hold of an XML payload from the client and stores it initially as an InputStream i.e. on the Representation object you can call getStream(). I want to utilise the XML held in the InputStream and I am begining to think it would be wise to persist it, so I can interroga...

Using Graphics.copyArea with transparent image

I'm trying to shift a portion of an image, currently using g.copyArea(). It works fine with solid colors, but the transparent pixels aren't being copied (because they're transparent!). I want to make the color underneath transparent. This image shows what's happening, if a start shape was copied, but I want the whole area to copy, overw...

Best way for many classes to reference a database connection class

I'm soon going to be starting the development stage of my coursework and the current design is to have a single class that handles database connections and many classes that call it; the database class is supposed to open the connection and pass queries along blindly, other classes are responsible for the contents of those queries. Wha...

Translating Java bytecode into other representations and programming languages

I'm looking for ways/tools/projects to translate Java bytecode into other programming languages or, failing that, at least into a structured representation (like XML). Ideally open source, naturally. I've looked at ASM, the "bytecode manipulation and analysis framework". It doesn't support translation to other representations, but looks...

How do I get Java to use the serial port in Linux?

We make use of a java application that manages a pinpad via the serial port. This works perfectly on windows with the Sun Comm.jar, the supplied dll and the properties file. Now we are attempting to use this solution on Linux (actually it does run on various other flavours of linux out in the field) - with Ubuntu server mode. After muc...

How do I drag and drop a row in a JTable?

How do you setup a JTable to be able to drag a row to a different index in the table. For example if I have 5 rows and I want to drag the 4th row to the 2nd position? ...

Java Applet z-index problem; Safari and beyond

A well known problem with Java Applets in webpages is that browsers ignore the z-index of the applet tag vs. other components in the page. No matter how you position and z-index elements in the page, applets will draw themselves on top of everything. There is a workaround, known as the iframe shim, is described here: http://www.oratran...

How to create a URL in a servlet?

Hi, i want to know how to generate a url in a servlet. I have a login servlet, and every time that add a user i want to gen. a url for each user profile. Can anyone help me please? ...

Java applet white screen

I'm trying to get to the bottom of a problem with our Java applet based program. It quite regularly seizes up with an unresponsive GUI (or a white screen). This of course only happens when deployed at a customer site :-(. They are running a version of the Sun JVM in 1.5 series (not sure the exact release). We have a theory that it's to ...