java

How can I programatically receive faxes? Preferable in java.

I need to be able to receive a fax in a java application. I was wondering what are some ways of doing this. Efax? Use a fax to email provider? ...

Is there a Java standard "both null or equal" static method?

To save some typing and clarify my code, is there a standard version of the following method? public static boolean bothNullOrEqual(Object x, Object y) { return ( x == null ? y == null : x.equals(y) ); } ...

Accessing RPG on iSeries from Java

Has anyone had good experiences of talking direct to RPG programs running on a V5R4 iSeries machine from Java? If so, what are the recommendations of the community, and what pitfalls should I try to avoid? From the various pieces of literature and spike solutions I have attempted it looks as though we can use ProgramCallBeans (either th...

Java ColorSpace Support

I need to take a BufferedImage and convert it to YCbCr format so that I can do a more efficient Brightness/contrast manipulation on it, but I can't figure out how to do this. I've tried ColorConvertOp but there doesn't seem to be an appropriate ColorSpace for YCbCr (though there is a type for it?). I could do the conversion manually ...

java.beans.Introspector getBeanInfo does not pickup any superinterface's properties

I just noticed that java.beans.Introspector getBeanInfo does not pickup any superinterface's properties. Example: public interface Person { String getName(); } public interface Employee extends Person { int getSalary(); } Introspecting on Employee only yields salary even though name is inherited from Person. Why is this? I wo...

Navigation on validation failure in Seam/JSF

I've been playing with Seam (2.0.2.SP1) for a few weeks, and I have most of the basics nailed down, but I haven't come up with a decent solution to the following. Suppose I have a form at /foo.xhtml, with a rewrite rule such that URLs like /foo.seam?id=<fooId> are converted to /foo/<fooId>. There's a commandButton on the form with an a...

What is good way to learn java?

I have a little experience in C++ and Java, but I want to be professional with them. Also, when i want to develop a secure application, what is the recommended way? ...

Java: AWT on Solaris

How is AWT implemented for Solaris? ie: What native libraries, if any, is it dependent on. ...

Largest Heap used in a managed environment? (.net/java)

What is the largest heap you have personally used in a managed environment such as Java or .NET? What were some of the performance issues you ran into, and did you end up getting a diminishing returns the larger the heap was? ...

Updating OpenLDAP using a Java class

I need to be able to update an attribute on OpenLDAP using a Java class. I've taken a stab at creating an LDAP entry, but it looks like a Java object instead of a proper LDAP entry. (Grrrr) import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingException; import javax.naming.NameAlreadyBoundExceptio...

Newbie in Java

What is this error? "cannot find symbol, symbol: method getstring(java.lang.String) Location: class InternalFrameDemo if ...

Java Generics Syntax for arrays

What data structure does the following declaration specify? List<ArrayList>[] myArray; I think it should declare an array where each element is a List (e.g., a LinkedList or an ArrayList) and require that each List contain ArrayList objects. My reasoning: List<String> someList; // A List of String objects List<ArrayLi...

How can I turn an int into three bytes in Java?

I am trying to convert an int into three bytes representing that int (big endian). I'm sure it has something to do with bit-wise and and bit shifting. But I have no idea how to go about doing it. For example: int myInt; // some code byte b1, b2 , b3; // b1 is most significant, then b2 then b3. *Note, I am aware that an int is 4 b...

How do I analyze a .hprof file?

I have a production server running with the following flag: -XX:+HeapDumpOnOutOfMemoryError Last night it generated a java-38942.hprof file when our server encountered a heap error. It turns out that the developers of the system knew of the flag but no way to get any useful information from it. Any ideas? ...

Overriding the java equals() method quirk

I ran into an interesting (and very frustrating) issue with the equals() method today which caused what I thought to be a well tested class to crash and cause a bug that took me a very long time to track down. Just for completeness, I wasn't using an IDE or debugger - just good old fashioned text editor and System.out's. Time was very ...

What is your method to generate Websphere 6 EJB with Ant / JDK 1.4.x ?

The only working method I found, several years ago, was : Generating ibm-ejb-jar-bnd.xmi and ibm-ejb-jar-ext.xmi for each session bean by using XDoclet (ejbdoclet task) Making a jar (without stubs) with task jar; ; Calling the binary EJBDEPLOY with this jar without stub in parameters. But I feel there must be a cleaner method. Whi...

Brainstorming: Requirements of a Swing Replacement

What is required of an updated and legacy free Graphical User Interface API for Java? //TODO: Add your ideas below. ...

Best way to find date nearest to target in a list of dates?

I have a list of Date objects, and a target Date. I want to find the date in the list that's nearest to the target date, but only dates that are before the target date. Example: 2008-10-1 2008-10-2 2008-10-4 With a target date of 2008-10-3, I want to get 2008-10-2 What is the best way to do it? ...

SCJP exam - your best tips for passing

Having recently started studying for the SCJP exam, I was wondering where to put some extra focus. So, to those of you who have taken the test (and preferably passed): Any particular topics I need to focus on? Any pitfalls I should be particularly wary of? Which part did you find hardest? Thanks! Edit: Answers like "take mock exams...

Can I list the resources in a given package?

Lets assume my classes are loaded from a compressed .war file or loaded elsewhere, how can I discover all the resources in a given package? Enumerating files will not really work, since this is a war file. Most likely this will involve using the current classloader? Is there a library out there that does something like that? Googling...