Showing posts with label mac os. Show all posts
Showing posts with label mac os. Show all posts

Friday, September 21, 2018

Setting a specific Java version to maven if you've multiple Java versions installed in the system

This is for the macOS:

By default, maven runs with the default JAVA_HOME configured in the system. If you want to set a different Java version temporarily for your maven - we need to change the JAVA_HOME in the mvn file. 

mvn shell file

#!/bin/bash
JAVA_HOME="${JAVA_HOME:-$(/usr/libexec/java_home)}" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"


Changed mvn shell file this to:

#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

However, if you wish to set a particular java version to the project permanently - that needs to be configured in the pom.xml file

Refer here:                   


For example, to set for Java 1.8
<properties>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.source>1.8</maven.compiler.source>
 </properties>


Java 7:

<properties>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
 </properties>


 But where can I find this mvn file in macOS?
$ which mvn
/usr/local/bin/mvn

$ cat mvn
#!/bin/bash
JAVA_HOME="/Library/Java/JavaVirtualMachines/jdk1.8.0_144.jdk/Contents/Home" exec "/usr/local/Cellar/maven/3.5.2/libexec/bin/mvn" "$@"

As you can see - mvn file is located in /usr/local/Cellar/maven/3.5.2/libexec/bin/



Friday, March 13, 2015

Breakpoints are not working with Xcode 6

There are many reasons for this.

Please check this:
http://stackoverflow.com/questions/64790/why-arent-my-breakpoints-working

In my case what worked for me is:
Click on the Xcode project-> Build Settings ->Build Options -> set "Debug Information Format" as "DWARF with dSYM File".

This is in Xcode 6.1

Thursday, March 12, 2015

Removing node.js and npm from mac os x

  1. Go to /usr/local/lib and delete any node and node_modules
  2. Go to /usr/local/include and delete any node and node_modules directory
  3. check your Home directory for any local or lib or include folders, and delete any node or node_modules from there
  4. Go to /usr/local/bin and delete any node and npm executable.
  5. If you have installed in any other custom directory, please remove that as well.

Use below command to remove recursively.
>sudo rm -rf node
>sudo rm -rf node_modules


rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}

Monday, October 13, 2014

Copying files from Windows to Mac OS

For my reference

Download this software in Windows, this will allow to get the access to Mac os and you can easily transfer files from windows to mac using this.