java

Is there an equivalent to Java's Robot class (java.awt.Robot) for Perl?

Is there an equivalent to Java's Robot class (java.awt.Robot) for Perl? ...

Is it me, or is Eclipse horribly unpredictable?

I recently started using Eclipse at work for my Java servlet projects. I've been using jEdit for years, which is a uber-powerful text editor. It has syntax highlighting, but it doesn't have any language-specific features like code completion and intelligent refactoring. I'm finding that's hindering my productivity. I desperately want...

Can you provide an example of a byte buffer transferred between two java classes via UDP datagram?

see title? ...

What's the best way to distribute Java applications?

Java is one of my programming languages of choice. I always run into the problem though of distributing my application to end-users. Giving a user a JAR is not always as user friendly as I would like and using Java WebStart requires that I maintain a web server. What's the best way to distribute a Java application? What if the Java a...

How to concatenate two arrays in Java?

I need to concatenate two String arrays in Java. void f(String[] first, String[] second) { String[] both = ??? } What is the easiest way to do this? ...

Method Local Inner Class

public class Test { public static void main(String[] args) { } } class Outer { void aMethod() { class MethodLocalInner { void bMethod() { System.out.println("Inside method-local bMethod"); } } } } Can someone tell me how to print the message from bMethod? Thanks....

How to re-open the Java Console in Firefox 3 after I've closed it

I'm using firefox3 to run a Java Applet (on Linux). normally, when the JVM launches the Java Console window opens so I can see output from the Applet (stack traces etc.). However, if I close the console there appears to be no way of getting it back short of restarting Firefox (I have to close the console because it makes startup of the ...

Phantom Referenced Objects

Phantom References serve for post-mortem operations. The Java specification states that a phantom referenced object will not be deallocated until the phantom-reference itself is cleaned. My question is: What purpose does this feature (object not deallocated) serve? (The only idea i came up with, is to allow native code to do post-morte...

Java logger that automatically determines caller's class name

public static Logger getLogger() { final Throwable t = new Throwable(); final StackTraceElement methodCaller = t.getStackTrace()[1]; final Logger logger = Logger.getLogger(methodCaller.getClassName()); logger.setLevel(ResourceManager.LOGLEVEL); return logger; } This method would return a logger that knows the class it's logging fo...

Hibernate Tools and the ever changing database

I am currently using Hibernate Tools 3.1; I customized naming convention and DAO templates. The database (SQL Server 2005) in early development phase and I'm in charge of rebuilding the mappings, entities, DAOs, configuration, whatever. Each time I have to reverse-engineer the tables and so I lose every customization I made on the mappin...

Active threads in ExecutorService

Any ideas how to determine the number of active threads running in ExecutorService? ...

JAX-RS Frameworks

I've been doing some work with the JAX-RS reference implementation (Jersey). I know of at least two other frameworks (Restlet & Apache CXF). My question is: Has anyone did some comparison between those frameworks and if so, which framework do you recommend and why? ...

Dynamic contact information data/desing pattern: Is this in any way feasible?

I'm currently working on a web business application that has many entities (people,organizations) with lots of contact information ie. multiple postal addresses, email addresses, phone numbers etc. At the moment the database schema is such that persons table has postal address columns, phone number columns as does organizations table. ...

Get Methods: One vs Many

getEmployeeNameByBatchId(int batchID) getEmployeeNameBySSN(Object SSN) getEmployeeNameByEmailId(String emailID) getEmployeeNameBySalaryAccount(SalaryAccount salaryAccount) or getEmployeeName(int typeOfIdentifier, byte[] identifier) -> In this methods the typeOfIdentifier tells if identifier is batchID/SSN/emailID/salaryAccount Which o...

Read Firefox 3 bookmarks

Firefox 3 stores the bookmarks in a sqlite database. There are several hacked sqlite java libraries available. Is there a way to hack the sqlite database in java(not using libraries) to read bookmarks reliably? Does someone know how the sqlite DB is stored and access programmatically (from java)? ...

Auto-generating Unit-Tests for legacy Java-code

What is the best, preferably free/open source tool for auto-generating Java unit-tests? I know, the unit-tests cannot really serve the same purpose as normal TDD Unit-Tests which document and drive the design of the system. However auto-generated unit-tests can be useful if you have a huge legacy codebase and want to know whether the cha...

Java: Easiest way to merge a release into one jar-file

Hi, I wonder if someone knows of a tool or script which easily merges a bunch of jar-files into one .jar. A bonus would be to easily set the main-file manifest and make it executable. The concrete case is a java restructured text tool: http://jrst.labs.libre-entreprise.org/en/user/functionality.html I would like to run it with someth...

Changing the default encoding for String(byte[])

Is there a way to change the encoding used by the String(byte[]) constructor ? In my own code I use String(byte[],String) to specify the encoding but I am using an external library that I cannot change. String src = "with accents: é à"; byte[] bytes = src.getBytes("UTF-8"); System.out.println("UTF-8 decoded: "+new String(bytes,"UTF-8")...

Most efficient way to increment a Map value in Java

I hope this question is not considered too basic for this forum, but we'll see. I'm wondering how to refactor some code for better performance that is getting run a bunch of times. Say I'm creating a word frequency list, using a Map (probably a HashMap), where each key is a String with the word that's being counted and the value is an I...

Java: why do I receive the error message "Type mismatch: cannot convert int to byte"

If you declare variables of type byte or short and attempt to perform arithmetic operations on these, you receive the error "Type mismatch: cannot convert int to short" (or correspondingly "Type mismatch: cannot convert int to byte"). byte a = 23; byte b = 34; byte c = a + b; In this example, the compile error is on the third line. ...