java

Selecting proper toolkit for a 2D simulation project in Java.

I am looking for a toolkit that will allow me to design widgets containing 2D graphics for an elevator simulation in Java. Once created, those widgets will be integrated with SWT, Swing, or QtJambi framework. Background information: I am developing an Elevator Simulator for fun. My main goal is to increase my knowledge of Java, Eclips...

Can CLIENT-CERT auth-method be used with a JDBC realm within tomcat?

The JDBC realm specifies a table structure for authentication which contains the columns defined by the attributes userNameCol and userCredCol. These correspond to user and password which makes sense for FORM or BASIC auth-methods. They are interactive and require these two pieces from the client's user. What comes back from the cert...

Regular expresion to match urls JAVA

I use RegexBuddy while working with regular expressions. From its library i copied the regular expression to match urls. I tested succesfully within regexbuddy. However, when I copied it as Javas String flavor and pasted it into java code it does not work. The next class prints false: public class RegexFoo { public static void mai...

Type mismatch for Class Generics

I have the following code that won't compile and although there is a way to make it compile I want to understand why it isn't compiling. Can someone enlighten me as to specifically why I get the error message I will post at the end please? public class Test { public static void main(String args[]) { Test t = new Test(); t....

Logging conventions

What conventions do you use for log categories in log4j or similar libraries ? Usually you see class names as categories, but have you used other systems ? What about log levels ? What levels do you use and in which case ? Update: as some of you replied, there is no 'right' answer. I'm just looking for what different conventions people...

Enum inside a JSP

Is there a way to use Enum values inside a JSP without using scriptlets. e.g. package com.example; public enum Direction { ASC, DESC } so in the JSP I want to do something like this <c:if test="${foo.direction ==<% com.example.Direction.ASC %>}">... ...

Should Model make service calls to get data

We are build a website using MVC pattern. So far all the pages we built used models which had to operate on Reference data(which is cached when the website loads for the first time). But now we have reached that stage of the flow where we have to deal with Transactional data (which is specific to that flow). Till now we created model cla...

JDK/JRE source code with matching JSSE (SSL) source code and matching runnable JDK / JRE?

I have seen Where to find Java 6 JSSE/JCE Source Code? and asked the question myself How to get JRE/JDK with matching source? but I don't either of these was specific enough to get the answer I was really after, so I'm going to try a way more specific version of the question. Basically the problem that I am trying to solve is that I wou...

What is the best book or piece of documentation on Java Swing?

I am very likely to be starting a new project at work and will need to use the Java Swing library. I would like to get up to speed pretty quickly, preferably in the next two months. What do you consider to be the best documentation (either online or in book form) to help me get a solid grasp on the library? ...

Which SVG toolkit would you recommend to use in Java?

As a follow-up to another question, I was wondering what would be the best way to use SVG in a Java project. ...

Which Java profiler is better: JProfiler or YourKit?

Which profiler is better for general purpose profiling and heap analysis? 90% of our apps are standalone command line programs with substantial database and numeric processing. The other 10% are webapps/servlet container apps (with very little JSP and NO SCRIPLETS!). Target user would be Sr Software Engineer with 5-10 years of industry e...

Autoconf test for JNI include dir

I'm working on a configuration script for a JNI wrapper. One of the configuration parameters is the path to jni.h. What's a good quick-and-dirty Autoconf test for whether this parameter is set correctly for C++ compilation? You can assume you're running on Linux and g++ is available. Alternatively, is there a way to get javah (or a supp...

Refactoring Nicely with Version Control

A co worker of mine asked me to review some of my code and he sent me a diff file. I'm not new to diffs or version control in general but the diff file was very difficult to read because of the changes he made. Specifically, he used the "extract method" feature and reordered some methods. Conceptually, very easy to understand but look...

Classical set operations for java.util.Collection

Is there any built-in functionality for classical set operations on the java.util.Collection class? My specific implementation would be for ArrayList, but this sounds like something that should apply for all subclasses of Collection. I'm looking for something like: ArrayList<Integer> setA ... ArrayList<Integer> setB ... ArrayList<Intege...

Make your collections thread-safe?

When designing a collection class, is there any reason not to implement locking privately to make it thread safe? Or should I leave that responsibility up to the consumer of the collection? ...

Testing onbeforeunload events from Selenium

I'm trying to write a Selenium test for a web page that uses an onbeforeunload event to prompt the user before leaving. Selenium doesn't seem to recognize the confirmation dialog that comes up, or to provide a way to hit OK or Cancel. Is there any way to do this? I'm using the Java Selenium driver, if that's relevant. ...

How do I avoid page breaks inside tables and groups in BIRT ?

When creating reports using BIRT 2.3.1, I don't want page breaks inside tables or groups; if the table doesn't fit in the space available at the page, I want to put the entire element in the next page. Using previous versions of BIRT it was possible to set pageBreakInside to "avoid", but it didn't work. In BIRT 2.3.1 this (useless) opt...

Create a BCEL JavaClass object from arbitrary .class file

I'm playing around with BCEL. I'm not using it to generate bytecode, but instead I'm trying to inspect the structure of existing compiled classes. I need to be able to point to an arbitrary .class file anywhere on my hard drive and load a JavaClass object based on that. Ideally I'd like to avoid having to add the given class to my cla...

Best Library for programatically inspecting Java class files

I'm working on a project where we're doing a lot of remote object transfer between a Java service and clients written in other various languages. Given our current constraints I've decided to see what it would take to generate code based on an existing Java class. Basically I need to take a .class file (or a collection of them) parse t...

fmt:parseDate - a parse index locale can not be established

Does anyone know the root cause of this error? I am feeding known good data to the fmt:parseDate tag (its db driven data controlled by us), and yet this error randomly pops up. I can't seem to find a way to replicate what causes this exception. ...