Skip to content

Tag: java

Android: javac vs Dalvik

My understanding is that Google didn’t like Oracle’s licensing policy for using the JRE in Java ME so it just rewrote it using its own JVM specification that mimics the JRE but behaves a little bit differently, especially when it comes to making things more efficient and more secure. So, if my und…

How to download sources for a jar with Maven?

In my project I am using a JAR file provided via Maven. But what Maven gives me is only this jar – no javadocs and no sources. Pressing “Download Sources” has no effect: Eclipse still does not find the sources of the jar. What this depends on? Should repository provide sources automatically?…

Gradle does not find tools.jar

I am using javadoc doclets with gradle, so I need to use the package tools.jar, which is in the lib folder from the jdk (1.6.0_26 in my case). The point is that gradle does not take it automatically, so I was adding that tools package to my libs folder, and then adding it to dependencies.gradle . Now I want t…

mac os java version from root is different

after installing jdk7u5 for mac os I got different java-versions for “normal” user and root. java -version gives me the 7. sudo java -version gives me the 6. I’ve looked up in the /System/Library/Frameworks/JavaVM.framework/Versions/ found that there are some links. After I resolved the link…

How to set Saxon as the Xslt processor in Java?

This is a simple question, but one I cannot find the answer to. I have an XSLT 2.0 stylesheet that I’m trying to process in Java. It relies on XSL elements from Saxon. My current class works fine with simple XSLT 1.0, but I’m getting errors about unrecognized elements with my 2.0 XSLT built with S…

Compare two objects in Java with possible null values

I want to compare two strings for equality when either or both can be null. So, I can’t simply call .equals() as it can contain null values. The code I have tried so far : What will be the best way to check for all possible values including null ? Answer This is what Java internal code uses (on other

How to view the source code inside a JAR file?

I downloaded the code for a LAN messenger from sourceforge. It is an executable JAR file. You double-click it and your messenger starts. I want to study the source code. How do I do that? Answer Sourceforge has links to the source.

Deserializing non-string map keys with Jackson

I have a a map that looks like this: My verb class looks like this: I want to serialize and deserialize instances of my VerbResult class, but when I do I get this error: Can not find a (Map) Key deserializer for type [simple type, class my.package.Verb] I read online that you need to tell Jackson how to deser…