Category: Java

  • Java: One-liner check if you have the JCE Unlimited Strength Jurisdiction Policy

    ,

    In case you installed the the “stronger” Java Crytography Extension, you can check with: $JAVA_HOME/bin/jrunscript -e 'print (javax.crypto.Cipher.getMaxAllowedKeyLength("RC5") >= 256);'

  • Java code snippet: Enumeration to return String value

    ,

    I probably should be adding this kind of stuff on GitHub, but I’m lazy. 🙂 public enum TokenType {     TICKET("ticket"),     UNKNOWN("unknown");     private String tokenType;     TokenType(String tokenType) {         this.tokenType = tokenType;     }     public String getTokenType() {         return tokenType;     }     public boolean isTicket() {         return this == TICKET;     }     public boolean isValidType() {         return this == TICKET;…

  • Maven error with Java 6 on OS X: “Unsupported major.minor version 51.0”

    ,

    If you encounter the error below with Java 6 on OS X, make sure you’re using Maven 3.2.5 or older. $ mvn Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0   at java.lang.ClassLoader.defineClass1(Native Method)   at java.lang.ClassLoader.defineClassCond(ClassLoader.java:637)   at java.lang.ClassLoader.defineClass(ClassLoader.java:621)   at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)   at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)   at java.net.URLClassLoader.access$000(URLClassLoader.java:58)   at java.net.URLClassLoader$1.run(URLClassLoader.java:197)   at java.security.AccessController.doPrivileged(Native Method)   at java.net.URLClassLoader.findClass(URLClassLoader.java:190)   at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClassFromSelf(ClassRealm.java:401)…

  • Seven wastes of software development

    Perfect for analyzing why a ticket you worked on longer than expected, which usually always does! Check it out here! Quickly, though, they are: Partially Done Work Extra Features Relearning Handoffs Delays Task Switching Defects

  • Seven performance metrics for Java applications

    I came across this in this blog post and am adding it here as a checklist. It’s a worthwhile list to have so you can understand how your Java app behaves in production. Response times and throughput Load Average Error Rates (and how to solve them) GC rate and pause duration Business Metrics Uptime and service…

  • Switching between multiple Java versions on OS X quickly

    If you’re a Java developer like me, you will need to work on various Java versions. If so, adding the following in your ~./bash_profile makes switching between versions a snap. (As of this writing, I’m running on OS X El Capitan.) alias java6='export JAVA_HOME=$(/usr/libexec/java_home -v 1.6);java -version' alias java7='export JAVA_HOME=$(/usr/libexec/java_home -v 1.7);java -version' alias java8='export…