java

How do I keep CFEXECUTE from hanging after a PrintStackTrace

I'm using ColdFusion MX7 to perform a CFEXECUTE on some Java 6 code. Unfortunately sins CF7 does not work under JDK 6 I must do it this way. My problem is that when an exception happens in the Java code if I call a printStackTrace on the exception the CFEXECUTE command hangs. Coldfusion eventually times out but the java process cont...

Problems with BufferedReader / PrintWriter?

I'm using BufferedReader and PrintWriter to go through each line of an input file, make a change to some lines, and output the result. If a line doesn't undergo a change, it's just printed as is to the output file. For some reason however, the process ends prematurely. The code looks something like this: BufferedReader in = new Buffered...

Is there an Ubuntu 9.04 OpenJDK equivalent of sun-java6-plugin?

Hi, I'm wondering if there exists an implementation of a firefox plugin for OpenJDK, or how one would get firefox to use OpenJDK's java for applets. I've searched endlessly, and I can't seem to find any good resources. Any ideas? ...

Unable to upload zip files occasionally

Tomcat server runs in US. I am connecting to the server from China using Java's HTTPURLConnection. Please see the code snippet used in client side and the https connector configuration in the tomcat server side below. <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 --> <Connector acceptCount="100" clientAuth="false" connec...

Creating an object

Box buttonBox = new Box(BoxLayout.Y_AXIS); Name1 name2 = new Name1(); there are two Name1s checkboxList = new ArrayList<JCheckBox>(); name2 = new Name1(); there is only one Name1 It works, but why? ...

How to scale up in Java

I have 100+ channels of video streams to process all at the same time. I need to capture the video, generate thumbnails, and serve them out as a web service. For the generation of thumbnail, I can use JMF etc.(I noticed there is another post talking about how to generate and access: http://stackoverflow.com/questions/772715/better-qualit...

Why do radio buttons render improperly in a java.awt.Dialog on the Mac when the dialog is modal?

I'm in the process of testing my Java application on the Mac and I've run into a very strange issue. Checkboxes that appear in a modal Dialog render incorrectly, though non-modal Dialogs work fine. For example, say I have a window with 2 radio buttons. When the dialog opens the first one is selected. When I click on the second button...

Why does JSP/JSTL division by 1000 sometimes give remainder?

When dividing by 1000 I sometime run across a bug that doesn't do the division "correctly". For example, when dividing 90.55 by 1000 instead of getting .09055 I get .090549999999. <c:out value="${bean.paPrice / 1000}" /> Why is this happening? Is this a result of floating point math? A google search seemed to indicate that this may...

log4j.xml in client jars

I have some jar files that will be distributed to clients that are using log4j for logging. My question is should I include a log4j.xml configuration in the jar file or have the client provide one if they want logging? My feeling is to leave the log4j.xml configuration file out of the client jars, since the apache jar files all come wi...

Android: Best practice for responsive user interfaces

Hi, I am quite new to Android and Java. Before I was working with C++ where the events where dispatched with messages. Now I would like to create the same user experience for Android platform and I would appreciate any of your suggestions or comments on what is the best way to bind events to user controls. Here is an example from C++: ...

How do I model the byte[] type in XSD?

I have the following object XSD type. The Data element should actually be represented by a byte[] type, however, I am not sure how to model this in XSD. Could anyone help? ...

OneToOne relationship with shared primary key generates n+1 selects; any workaround?

Imagine 2 tables in a relational database, e.g. Person and Billing. There is a (non-mandatory) OneToOne association defined between these entities, and they share the Person primary key (i.e. PERSON_ID is defined in both Person and Billing, and it is a foreign key in the latter). When doing a select on Person via a named query such as: ...

Reference to object during finalize

What happens if you save a reference to the current object during the finalize call? For example: class foo { ... public void finalize() { bar.REFERENCE = this; } } Is the object garbage-collected, or not? What happens when you try to access bar.REFERENCE later? ...

How to query multiple SUMs of the same item using SQL in iReport

I'm creating a JasperReport using iReport, and as such, I'm limited* to one SQL query. I have a table 'statistics', with a 'name' (VARCHAR), 'count'(INTEGER), and 'datetime'(DATETIME) columns. It is simple enough to get the sum of the 'count' column when the 'name' was "test" for the last day, and similarly for the last week, and month ...

How can I host a Java Swing component in a .NET application

I have some Java user interface controls that I want to host in my .NET application as I can't afford to rewrite them. How can I do that? Do I need to wrap them up in COM? How do I do that? I want the component to sit on a form with other components written in .NET. ...

quick fix for JSP with in Eclipse?

I'm running Eclipse 3.4 java enterprise adition and writing JSP pages with it. It does not appear to support quick fix, for example ArrayList ourList; comes up as an error but there isn't a quick fix option to add the import java.util.ArrayList statement. Is there a way to improve quick fix capabilities, or another set of Eclipse Plugins...

java p2p video library?

is any such library available either commercial or open source? ...

Custom logging to gather messages at runtime

Is there a way to create a log4j Logger at runtime that will gather logging messages into a buffer? I currently have a class that logs a number of events. For a remote application that needs to monitor the logged events, I'd like to just swap in a logger that logs to a buffer and then retrieve the buffer, rather than refactor the class...

C# Regex Split To Java Pattern split

I have to port some C# code to Java and I am having some trouble converting a string splitting command. While the actual regex is still correct, when splitting in C# the regex tokens are part of the resulting string[], but in Java the regex tokens are removed. What is the easiest way to keep the split-on tokens? Here is an example of ...

Hashmap concurrency issue

I have a Hashmap that, for speed reasons, I would like to not require locking on. Will updating it and accessing it at the same time cause any issues, assuming I don't mind stale data? My accesses are gets, not iterating through it, and deletes are part of the updates. ...