---
title: "JAVA_HOME in MacOSX"
author: "贝壳水母"
date: "2015-12-28T12:13:18Z"
tags: []
categories: ["移动开发"]
slug: "java-home-in-macosx"
draft: false
lastmod: "2015-12-28T12:09:13Z"
id: 2267142
url: "https://shineonly.iteye.com/blog/2267142"
---

CocosIDE打包APK报：

```console
Error: JAVA_HOME is not defined correctly.
  We cannot execute /System/Library/Frameworks/JavaVM.framework/Home/bin/java
```


把ant脚本这一段删掉：
--- /opt/local/share/java/apache-ant/bin/ant.orig	2012-02-09 12:02:30.000000000 -0500
+++ /opt/local/share/java/apache-ant/bin/ant	2012-02-09 12:02:53.000000000 -0500
@@ -83,11 +83,7 @@
 mingw=false;
 case "`uname`" in
   CYGWIN*) cygwin=true ;;
-  Darwin*) darwin=true
-           if  ; then
-             JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
-           fi
-           ;;
+  Darwin*) darwin=true ;;
   MINGW*) mingw=true ;;
 esac

参考：
<https://bz.apache.org/bugzilla/show_bug.cgi?id=52632>