Java Ninja Chronicles By Norris Shelton

Things I learned in the pursuit of code

Intellij IDEA doesn’t show hidden files in the file chooser dialog on Mac OS/X. This can be frustrating when you are trying to find files that are always in a hidden directory, such as Maven files. There are two ways around this.

This will enable it for the current window

ctrl + shift + .

There is another solution, but it involves editing the registry. Hit the following keys to access the Find Action menu.

cmd + shift + a

Once there, scroll down to ide.mac.file.chooser.show.hidden.files. Check the checkbox and select Close and away you go.

July 28th, 2015

Posted In: IntelliJ, java ninja, Javaninja, Mac, OS/X

Tags: , , ,

One Comment

I found a very useful link
http://www.jayway.com/2014/01/15/how-to-switch-jdk-version-on-mac-os-x-maverick/

I added the following to my .profile and typed setjdk 1.7 at the command prompt. Problem solved.

function setjdk() {  
  if [ $# -ne 0 ]; then  
   removeFromPath '/System/Library/Frameworks/JavaVM.framework/Home/bin'  
   if [ -n "${JAVA_HOME+x}" ]; then  
    removeFromPath $JAVA_HOME  
   fi  
   export JAVA_HOME=`/usr/libexec/java_home -v $@`  
   export PATH=$JAVA_HOME/bin:$PATH  
  fi  
 }  
 function removeFromPath() {  
  export PATH=$(echo $PATH | sed -E -e "s;:$1;;" -e "s;$1:?;;")  
 }

I have the following JDKs setup on my Mac with OSX 10.10.5 in /Library/Java/JavaVirtualMachines.

drwxr-xr-x  3 root  wheel  102 Jul 14 17:52 1.6.0.jdk
drwxr-xr-x  3 root  wheel  102 Jul  2 20:01 jdk1.8.0_45.jdk
drwxr-xr-x  3 root  wheel  102 Nov 13  2014 jdk1.8.0_25.jdk
drwxr-xr-x  3 root  wheel  102 Oct 28  2013 jdk1.7.0_45.jdk

As you can see from the following, it does work

dimac0001:~ norrisshelton$ setjdk 1.6
cdimac0001:~ norrisshelton$ java -version
java version "1.6.0_65"
Java(TM) SE Runtime Environment (build 1.6.0_65-b14-468-11M4833)
Java HotSpot(TM) 64-Bit Server VM (build 20.65-b04-468, mixed mode)
cdimac0001:~ norrisshelton$
cdimac0001:~ norrisshelton$
cdimac0001:~ norrisshelton$ setjdk 1.7
cdimac0001:~ norrisshelton$ java -version
java version "1.7.0_45"
Java(TM) SE Runtime Environment (build 1.7.0_45-b18)
Java HotSpot(TM) 64-Bit Server VM (build 24.45-b08, mixed mode)
cdimac0001:~ norrisshelton$
cdimac0001:~ norrisshelton$
cdimac0001:~ norrisshelton$ setjdk 1.8
cdimac0001:~ norrisshelton$ java -version
java version "1.8.0_45"
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

Go to the Oracle JDK download page to get the latest version of java. The page is currently located at http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

March 3rd, 2014

Posted In: Bash, OS/X

Tags: , , ,

Leave a Comment

I couldn’t find the hosts file on my mac. I was used to finding the hosts file on a Linux system at /etc/hosts. They are in another location on a Mac 10.9.

/private/etc/hosts

December 20th, 2013

Posted In: Mac, OS/X

Tags: , , , , ,

2 Comments

When my OS was upgraded, I had to start typing the FQDN for all of the servers I used for work. I knew it had something to do with /etc/hosts on other Linux machines.

The file that needs to be changed for OSX is /etc/resolv.conf. there is a line that begins with search. Add the domain names that you want appended and it will append them in order until if finds the host.

February 8th, 2013

Posted In: Mac, OS/X

Tags: , , ,

Leave a Comment

Something like this normally works on Linux:

find . -type D -name .svn | rm -r

Not on Mac. You have to remember to add xargs

find . -type D -name .svn | xargs rm -r

Without the xargs, it is like calling rm without a target.

December 5th, 2011

Posted In: Mac, OS/X

Tags: , ,

Leave a Comment

LinkedIn Auto Publish Powered By : XYZScripts.com