Java
Customizing the version of Java used by default on a Mac
daniel Thu, 11/06/2014 - 10:49am
To customize what version of Java is used by default on your mac (once you've installed another version of Java):
At the command line:cd /System/Library/Frameworks/JavaVM.framework/Versions
sudo rm CurrentJDK
sudo ln -s /Library/Java/JavaVirtualMachines/jdk{version number here}.jdk/Contents CurrentJDK
For those updating their Macs to Yosemite it will revert the CurrentJDK symlink to the system default even if you have customized it.
Posting this because a friend needed it... I would never advocate using such a platform :)
Verify Java Cryptography Extensions ( JCE ) installed
daniel Mon, 08/04/2014 - 1:05pm
Verified by creating the following class
import javax.crypto.*;
import java.security.*;
public class JceTest {
public static void main (String[] args){
boolean isUnlimitedSupported = false;
try {
KeyGenerator kgen = KeyGenerator.getInstance("AES", "SunJCE");
kgen.init(256);
isUnlimitedSupported = true;
} catch (NoSuchAlgorithmException e){
isUnlimitedSupported = false;
} catch (NoSuchProviderException e) {
isUnlimitedSupported = false;
}
System.out.println("isUnlimitedSupported=" + isUnlimitedSupported);
}
}
and running: javac JceTest.java; java JceTest
from: Stack Overflow
Options for working with Xml in Java by mkyong
daniel Thu, 06/12/2014 - 10:29am
- Read more about Options for working with Xml in Java by mkyong
- Log in to post comments
SpringOne 2GX highlights
daniel Fri, 05/02/2014 - 5:58pm
- Read more about SpringOne 2GX highlights
- Log in to post comments
Google's Style guide for Java
daniel Fri, 05/02/2014 - 5:57pm
- Read more about Google's Style guide for Java
- Log in to post comments
Import OpenSSL certificate into java keystore on Ubuntu
daniel Mon, 04/21/2014 - 11:28am
First Step:
Convert the cert into a Java Keystore:openssl pkcs12 -export -name mycert.local -in /etc/ssl/certs/mycert.local.cert -inkey /etc/ssl/private/mycert.local.key -out mycert.local.keystore.p12
Second Step:
Import the new keystore (Using the primary java keystore of an Oracle Java install on Linux here:keytool -importkeystore -srckeystore mycert.local.keystore.p12 -destkeystore /usr/lib/jvm/default-java/jre/lib/security/cacerts -srcstoretype pkcs12
Java / Grails Application Metrics
daniel Wed, 04/09/2014 - 10:49am
Interesting Metrics Libraries:
- Read more about Java / Grails Application Metrics
- Log in to post comments
Intermediate Debugging in Eclipse
daniel Tue, 02/11/2014 - 3:20pm
Debugging with eclipse tips from codecentric.de
Particularly useful to me were the sections:
Navigation: Drop to Frame, Variables View: Show Logical Structure
The stuff on Detail Formatters was useful as well.
Note that Eclipse will truncate long strings in the detail view, but you can increase this limit. However, with very large values, you'll find it much easier to change the underlying code adding a log statement due to the detail view being really slow to render.
- Read more about Intermediate Debugging in Eclipse
- Log in to post comments
Deploy to Archiva from Grails
daniel Fri, 01/03/2014 - 2:01pm
In your ~/.grails/settings.groovy
String archivaUsername = "daniel"
String archivaPass = ""
String archivaHost = "myArchivaHost.bowerstudios.com"
grails.project.ivy.authentication = {
credentials {
realm = "Repository Archiva Managed releases Repository"
host = archivaHost
username = archivaUsername
password = archivaPass
}
}
grails.project.repos.bowerStudiosArchiva.url = "http://${archivaHost}/archiva/repository/releases"
grails.project.repos.bowerStudiosArchiva.username = archivaUsername
grails.project.repos.bowerStudiosArchiva.password = archivaPass
grails.project.repos.default = "bowerStudiosArchiva"
Then, as long as you have the release plugin installed:
To install to your local maven cache:grails maven-install
To install to Archiva:grails maven-deploy
- Read more about Deploy to Archiva from Grails
- Log in to post comments
SSL keys to java keystore
daniel Thu, 12/26/2013 - 3:24pm
Created a private key and cert request using openssl. Sent it off to get a Rapid ssl cert, and had to do the following:
Concatenate the primary and secondary ca certs with the cert issued by rapid ssl: cat primary_inter.cer secondary_inter.cer host.bowerstudios.com.cert > certs.cert
Next, I used openssl to create a "combined store"openssl pkcs12 -export -in certs.cert -inkey host.bowerstudios.com.key -certfile certs.cert -name host.bowerstudios.com -out host.bowerstudios.com.p12
Now, import the keystore into a java keystorekeytool -importkeystore -srckeystore host.bowerstudios.com.p12 -srcstoretype pkcs12 -destkeystore tomcat.keystore -deststoretype JKS
- Read more about SSL keys to java keystore
- Log in to post comments
