Is Ant still the best choice for a Java build tool?
From my small amount of experience, I've only used Ant as a build tool. Are there any other projects which are better, and why? ...
From my small amount of experience, I've only used Ant as a build tool. Are there any other projects which are better, and why? ...
I'm using the standard logger from java.util.logging and by default the console output is directed to the error stream (i.e. same as System.err.println). How do I change the console output to the output stream (i.e. same as System.out.println) ...
I have a large collection of data in an excel file (and csv files). The data needs to be placed into a database (mysql). However, before it goes into the database it needs to be processed..for example if columns 1 is less than column 3 add 4 to column 2. There are quite a few rules that must be followed before the information is persiste...
Hi all, I just played with Java file system API, and came down with the following function, used to copy binary files. The original source came from the Web, but I added try/catch/finally clauses to be sure that, should something wrong happen, the Buffer Streams would be closed (and thus, my OS ressources freed) before quiting the funct...
I'm going to be writing a chess server and one or more clients for chess and I want to describe the rules of chess (e.g. allowable moves based on game state, rules for when a game is complete) in a programming language independant way. This is a bit tricky since some of the chess rules (e.g. King Castling, en passent, draws based on 3 or...
I know we can use tools like JProfiler etc. Is there any tutorial on how to configure it to display the memory usage just by remote monitoring? Any idea? ...
Hello, colleagues, where do you store user-specific and machine-specific runtime configuration data for J2SE application? (For example, C:\Users\USERNAME\AppData\Roaming\ on Windows and /home/username on Unix) How do you get these locations in the filesystem in platform-independent way? Thanks for your advice! ...
What is the difference between applying the visitor design pattern to your code , and code like the following : interface Dointerface { public void perform(Object o); } public class T { private Dointerface d; private String s; public String getS() { return s; } public T(String s) { t...
Given a heapdump or a running VM, how do I discover what the contents of the permanent generation is ? I know about 'jmap -permstat' but that's not available on Windows. ...
I'm experimenting with internationalization by making a Hello World program that uses properties files + ResourceBundle to get different strings. Specifically, I have a file "messages_en_US.properties" that stores "hello.world=Hello World!", which works fine of course. I then have a file "messages_ja_JP.properties" which I've tried all...
Hi, I was asked to build a java system that will have the ability to load new code (expantions) while running. How do I re-load a jar file while my code is running? or how do I load a new jar? Obviously, since constant up-time is important, I'd like to add the ability to re-load existing classes while at it (if it does not complicate ...
At the moment a default entry looks something like this: Oct 12, 2008 9:45:18 AM myClassInfoHere INFO: MyLogMessageHere How do I get it to do this? Oct 12, 2008 9:45:18 AM myClassInfoHere - INFO: MyLogMessageHere Clarification I'm using java.util.logging ...
I've just started using Java's enums in my own projects (I have to use JDK 1.4 at work) and I am confused as to the best practice of using JavaDoc for an enum. I have found that this method works, but the resultant code is a little unrefined: /** * Doc for enum */ public enum Something { /** * First thing */ FIRST_THING, /** * Second t...
I would like the fastest and most accurate function boolean isReachable(String host, int port) that passes the following JUnit tests under the conditions below. Timeout values are specified by the JUnit test itself, and may be considered "unreachable." Please note: All answers must be platform-independent. This means that InetAddress.is...
Ryan Delucchi asked here in comment #3 to Tom Hawtin's answer: why is Class.newInstance() "evil"? this in response to the code sample: // Avoid Class.newInstance, for it is evil. Constructor<? extends Runnable> ctor = runClass.getConstructor(); Runnable doRun = ctor.newInstance(); so, why is it Evil? ...
I use public boolean mouseDown(Event ev, int x, int y) to detect a click of the mouse. I can distinguish between the right mouse button (ev.metaDown() is true) and the left and middle. How can i differentiate the left from the middle button? Or if it is impossible with mouseDown, what should i use? ...
Basically, I have a class with 2 methods: one to serialize an object into an XML file and another to read an object from XML. Here is an example of synchronized part from the method that restores an object: public T restore(String from) throws Exception { // variables declaration synchronized (from) { try { de...
I am working on an implementation for RSS feeds for a collaboration platform. Say there are several thousands of different collaboration rooms where users can share information, and each needs to publish an RSS feed with news, changes, etc... Using a plain servlet (i.e. http://www.site.com/RSSServlet/?id=roomID) is costly, every time an...
Got a class that serializes into xml with XMLEncoder nicely with all the variables there. Except for the one that holds java.util.Locale. What could be the trick? TIA. ...
I need a way to bind POJO objects to an external entity, that could be XML, YAML, structured text or anything easy to write and maintain in order to create Mock data for unit testing and TDD. Below are some libraries I tried, but the main problems with them were that I am stuck (for at least more 3 months) to Java 1.4. I'd like any insig...