java

How do I redirect output to stderr in groovy?

I'm looking for a way to redirect output in a groovy script to stderr: catch(Exception e) { println "Want this to go to stderr" } ...

java Best Debugging Options

I am trying to analyze a JVM crash that is occuring inconsistently. I get a hs_err_pid312.log file when it happens. i've added Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler(), but i'm not sure that will catch the error. What other things can i do so the next time this occurs, i can get as much informat...

generate CPU load in Java

I am conducting some throughput testing. My application has to read from JMS do some processing write to JMS My goal here is to simulate #2, 'some processing'. That is, introduce a delay and occupy the CPU for a given time (e.g. 500ms) before forwarding the event. The naive approach would be to Thread.sleep(500). This would introduc...

javafx and javadoc

I have generally been underwhelmed by JavaFX, but at least their API documentation is a big improvement over javadoc which has not gone through any substantial improvement in a decade. Is it possible to use JavaFX technology to generate more attractive javadoc for regular Java files? ...

How to Change Netbeans Fonts and Colors Preview Document?

Within the Netbeans 6.5's Tools -> Options -> Fonts & Colors -> Syntax dialog, you have the ability to change the look and feel of the Netbeans text editor. When you select a language, you are presented with a preview of your font/color scheme. However, when I preview Java, there are far more options for syntax changes than are being dis...

java web start JAVA_HOME

I have an application that starts a Swing gui using java web start. The user has 4 versions of java 1.6 installed (1.6.0.3, 1.6.0.5, 1.6.0.7. 1.6.0.11) Webstart is selecting java version 1.6.0.11 but JAVA_HOME is set to java version 1.6.0.3. Could this cause any potential problems for webstart? rich ...

Reasonable to hold an HttpUrlConnection open indefinitely to a remote REST endpoint?

I am looking to optimize a process that runs continually and makes frequent calls (> 1 per second on average) to an external API via a simple REST style HTTP post. One thing I've noticed is that currently, the HttpUrlConnection is created and closed for every API call, as per the following structure (non essential code and error handlin...

How to handle HUGE SQL strings in the source code.

I am working on a project currently where there are SQL strings in the code that are around 3000 lines. The project is a java project, but this question could probably apply for any language. Anyway, this is the first time I have ever seen something this bad. The code base is legacy, so we can suddenly migrate to Hibernate or something...

JDE for Emacs for JDK 6.10

Is there a version of JDE for emacs that supports the 6.10 JDK? I haven't been able to find any information on this. While it runs, every time I attempt to compile files the DJE says that it doesn't recognize my JDK version and reverts to assuming it is a Java5 version. ...

Online Java Book

Is there an online java book like Dive into Python for learning Python? Other resources online besides the standard Java Documentation (which is awesome but almost too technical) thx ...

Comparing existing data entries in Java

I have a HashMap relating Keys to Strings, and I need to compare some of the Strings against each other. However, some of the Strings may or may not be in the HashMap. Example: Let's say I have 4 Strings that I plan to compare to each other if possible, but only 3 of them end up in the HashMap. How can I compare the Strings that are p...

Can the CheckStyle module "NeedBraces" work with nested if/else blocks?

We are using CheckStyle to enforce our style standards. One of the style rules we opted to include was the NeedBraces module. NeedBraces specifies that every block type statement (such as if, else, for) must have opening and closing curly braces. However, as far as I can tell it isn't working entirely correctly. This example will tri...

Java web development framework with controls

Hi, First of all, I am a .NET/C# developer who does mostly web dev (so obviously use a lot of ASP.NET, C# and Sql Server). I'm also open to other languages and don't knock them. :) I want to learn Java because it will benefit my career, as when I reach the senior dev level, I am expected to understand another framework outside my first...

super() function in JAVA

Button class: class SubmitButton extends JButton implements ActionListener { public SubmitButton(String title){ super(title); .... Where I declare it: SubmitButton submit = new SubmitButton("Submit"); submit.setBounds(530+150, 200, 100, 25); How does super(title) set the String title to the title of the button? ...

Launching java classes via windows drag-and-drop

I have a java class file with a main method. In Windows, I would like to be able to drag files onto a desktop icon/short/etc that would call supply the filenames to my main method. Basically, I want to allow users to drag-and-drop files at program execution instead of having type them on the command line. Any thoughts? ...

Standalone java base java formatter

Is there a Java-based program(jar) that can format java code(indenting/spacing). If it would be configurable that would be great. ...

Processing CSV files from the Web using embedded Java database

Short version: assuming I don't want to keep the data for long, how do I create a database programmaticly in HSQLDB and load some CSV data into it to? My schema will match the files exactly and the files do have adequate column names. This is an unattended process. Details: I need to apply some simple SQL techniques to three CSV files...

JSTL Printing arrayList elements

I have a JSP page that receives an ArrayList of event objects, each event object contains an ArrayList of dates. I am iterating through the event objects with the following: How can I iterate through the dateTimes ArrayList of each event object and print out each events date/times ? ...

Is there any plugin framework for Java Applets?

We have a large Java application that run as applet or Java Web Start. And it grow more and more. Typical a user need only a small part of the classes. Because Java does not know which class can it found in which jar file that it load all jar files until it find the class. If it will load a class that not exist (for example a resource bu...

What is the size of a boolean variable in java?

Can any one tell the bit size of boolean in java? ...