java

The shutdown hook isn't executed when the application is launched using javaw.exe

If I'm using javaw.exe to launch a Java application, the shutdown hook isn't executed when users log off from their Windows account. The application is actually launched using a launch4j generated .exe file but I know it uses javaw.exe to start it. This seems to be a known bug: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4302814...

Maven vs. AspectJ - Example?

MY aspect works great from Eclipse with AspectJ plugin, however if I try to use it with Maven I get .... nothing. I tried this http://mojo.codehaus.org/aspectj-maven-plugin/includeExclude.html I add loggin in my aspect and I try to test it with junit test, but when I run mvn clean mvn test I get... [INFO] [aspectj:compile {execut...

Protocol Buffers with JPA

I'm currently building a P2P-system which uses Protocol Buffers for all communication between the peers. There's also a some centralized parts of the system where the peers communicate with a server. The server uses JPA to store the data it has about the peers. So essentially the clients has its data in Protocol Buffers-messages and the...

Moving files from one directory to another, using Java

Hello, I have problems with moving files in directories in Java. The problem is that I cannot understand why the program behaves the way it behaves. Below is a (slight) modification of my real program. I traverse directories of a directory. In each of these traversed directories there are text files, which I want to move into two subd...

Hosting Java Web Start application for inclusion into Linux distros

I authored a Java freeware (closed source) product that I deploy on a web host and distribute via JNLP, inclusive Linux clients. I plan to suggest this product for inclusion into several Linux distro, if possible "as is" (JNLP-based). Can I already contact distros, or I need to reconfigure something (deploy on another host, convert J...

Why is this java array considered two dimensional?

Consider this code: class arraytest { public static void main(String args[]){ int[] a = null , b[] =null; b = a; System.out.println( b ); } } the line b=a; is flagged by the compiler saying: Incompatible types, found int[], required int [][] Why is b considered two dimensional? I realize the "shortcut" declarat...

Why do Java's GtkLookAndFeel Popups have no border?

I have an already written Java Swing app (so no switching UI frameworks) that I would like to look at least decent using the GTKLookAndFeel. I've already accounted for things like font and component size differences across LookAndFeels, but one thing I can't figure out is why my popup menus have no borders at all. It appears they are u...

Use Scala to unit test Java?

I'm familiar with using mock objects to help unit test my Java types, but find the inflexibility can lead to verbose and cumbersome test types and a lot of repetition. I've looked at using Groovy for unit tests with moderate success. I'm interested in learning Scala for itself, but would also like some advice on using it for testing Jav...

Inconsistent behavior on java's ==

Consider this code: class test { public static void main(String[] args) { test inst_test = new test(); int i1 = 2000; int i2 = 2000; int i3 = 2; int i4 = 2; Integer Ithree = new Integer(2); // 1 Integer Ifour = new Integer(2); // 2 System.out.println( Ithree == Ifour ); inst_test....

An elegant way to implement shared classes that load heavy resources (in Java)

Hello, I have several classes which work as wrappers over some heavy libs, such as parsers, taggers, and other resources. All these libs have one thing in common: they have a load/init method which takes a serialized model (a large file) as input, and return a class that can be used to do concrete things such as parsing text. To illus...

Expression Value in Jasper Report

Hi , this is my expression code ; ($F{Personel_ODEME}.equals(Boolean.TRUE)) ? "PAID" : "NO PAID" if Personel is paid her/his tax jasper report will write PAID else NO PAID in Report.But in DB this field is BOOLEAN Type but expression is returning string type. SO i am getting "Can not cast from String to Boolean" error. how can i solv...

displaying errors in jsf fragment with <t:message> tag

I was just wondering if I could display errors on a separate jsp fragment. I have a requirement where I have to display hyperlink errors (i.e clicking any error would focus to respective input field) For example, if I have a form and there are 20 fields, then I am suppose to use 20 times <t:message> tag. I know I can use single <t:mess...

To split or not to split a class (in Java)

I have a sentence which is analyzed in different phases. First, I get some attributes (say, X, Y, Z): public class AnalyzedSentence { private String X; private String Y; private String Z; public AnalyzedSentence(String sentence) { extractX(); extractY(); extractZ(); } // getters, setters...

Resources on the newest Java sort algorithm

Where can I find1 information resources, and probably, the source code for that new adaptive mergesort based sort algorithm mentioned by Joshua Bloch on his Devvox 2008 interview, and is mentioned as a RFE report too? 1 Remark: I used my favorite search engine, and its largest competitor too, without satisfactory result other than the R...

some Hibernate Question

I have 2 question I wanna make Mysql table that have charset utf8 but I don't know where I shoud set the setting. (I just have a hibernate.cfg.XMl no any .xml file for hibernate) i dun want set mysql.ini file that default setting was UTF-8 I wanna put this setting in my hibernate. second Question: I have this table: CREATE TABLE `bui...

Java class representation of financial institution?

Would like to know if there's any opensource library that has a class representation of how a generic financial institution ought to be represented? Of the top of my head, I guess it should at least include a SWIFT code, location properties. ...

How do I obtain the file name from a directory name in Ant?

I have a DirSet which I would like to convert to a comma-delimited list of directory names. I'm not interested in the full path, just the names. Using the ant-contrib "for" task I've been able to iterate the directories and create the target list, but for the life of me I can't figure out how to extract just the directory name from the f...

Generating a comma-delimited file list with Ant

I'm trying to create a comma-delimited list of files or directories under the current directory. For instance, suppose I have the following folder structure: Root -- Directory1 -- Directory2 ... I want to generate a variable or property that contain "Directory1,Directory2." I've tried iterating (using ant-contrib "for" task) over a <...

Are there penalties for Enum Singletons?

Are there (performance) penalties* associated with the Enum Singleton Pattern in any way, as it seems to be used less than the classical singleton pattern or the inner holder class idiom? * Penalties, such as the cost of serializability in cases when it is not needed and such, or is the usage low because few of the developers read Effe...

Compare Java enum values

Is there a way to check if an enum value is 'greater/equal' to another value? I want to check if an error level is 'error or above'. ...