在Linux的shell中,使用export设置ANT_OPTS变量,值为1G

export ANT_OPTS=-Xmx1g
ant

同理在windows的cmd中,使用set设置ANT_OPTS变量,值为1G

set ANT_OPTS=-Xmx1g
ant

如果想设置成1.5G,使用 -Xmx1536m

如果是javac任务,需要使用'memoryinitialsize' 和 'memorymaximumsize'来指定

javac   srcdir="${src}"
destdir="${classes}"
source="1.6"
debug="true"
fork="true"
deprecation="off"
memoryinitialsize="512m"
memorymaximumsize="1024m"

如果报java.lang.OutOfMemoryError: PermGen space错误

设置方法:

ANT_OPTS="-Xmx2g -XX:MaxPermSize=512m"

参考:http://stackoverflow.com/questions/7494909/build-failed-java-lang-outofmemoryerror-java-heap-space

使用ant时 出现 java.lang.OutOfMemoryErro r: Java heap space的解决办法的更多相关文章

  1. SpringBoot整合Swagger2案例,以及报错:java.lang.NumberFormatException: For input string: ""原因和解决办法

    原文链接:https://blog.csdn.net/weixin_43724369/article/details/89341949 SpringBoot整合Swagger2案例 先说SpringB ...

  2. IDEA里运行代码时出现Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger的解决办法(图文详解)

    不多说,直接上干货! 问题详情 运行出现log4j的问题 -classpath "C:\Program Files\Java\jdk1.8.0_66\jre\lib\charsets.jar ...

  3. 关于java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream解决办法

    吉林的一个项目有个错误找了一天,有段报错是:   java.lang.NoClassDefFoundError: com/sun/mail/util/LineInputStream 1.遇到过两次,第 ...

  4. 关于java.lang.NoSuchMethodError: android.widget.RelativeLayout.setBackground的解决办法

    今天用一个安卓4.0.4版本的手机测试手上的项目,发现logcat弹出这样一个提示“java.lang.NoSuchMethodError: android.widget.RelativeLayout ...

  5. java.lang.IllegalArgumentException: Service Intent must be explicit 解决办法

    java.lang.IllegalArgumentException: Service Intent must be explicit 意思是服务必须得显式的调用 我之前是这样使用绑定Service的 ...

  6. MyEclipse for Spring启动时报错"An internal error occurred during: 'Updating indexes'.Java heap space"的解决办法

    问题 MyEclipse for Spring在启动时,报如下错误:An internal error occurred during: 'Updating indexes'.Java heap sp ...

  7. 创建Maven项目出现:An internal error occurred during: "Retrieving archetypes:". Java heap space 错误解决办法

    首先说明一下网上的方法: 在Eclipse中创建Maven的Web项目时出现错误:An internal error occurred during: "Retrieving archety ...

  8. IntelliJ IDEA web项目进行数据库连接时出现java.lang.ClassNotFoundException: com.mysql.jdbc.Driver错误解决办法

    首先看报错信息: 意思是找不到类:  com.mysql.jdbc.Driver.也就是说tomcat找不到MySQL数据库连接要用的jar包! 出现这种错误的原因是: 项目中没有导入这个jar包, ...

  9. java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListene解决办法

    照着以前写的项目搭一个框架,项目用到的是ssm,spring+spring mvc+mybatis,由Eclipse转战IDEA上,项目的文件夹有一些改变,在之前的小项目中喜欢把lib文件夹放在项目根 ...

随机推荐

  1. caffe搭建--WINDOWS+VS2013下生成caffe并进行cifar10分类测试

    http://blog.csdn.net/naaaa/article/details/52118437 标签: windowsvs2013caffecifar10 2016-08-04 15:33 1 ...

  2. linux的su和sudo(转载)

    来源:http://www.jb51.net/LINUXjishu/12713.html 一. 使用 su 命令临时切换用户身份 1.su 的适用条件和威力 su命令就是切换用户的工具,怎么理解呢?比 ...

  3. xorm

    https://github.com/go-xorm/xorm Simple and Powerful ORM for Go, support mysql,postgres,tidb,sqlite3, ...

  4. 正则表达式测试工具之Regex Match Tracer

    下载地址:http://www.regex-match-tracer.com/downloads 使用示例1:匹配 使用示例2:替换

  5. ubuntu下配置rails环境遇到的错误

    1.Could not find gem 'sqlite3 (>= 0)' in any of the gem sources listed in your Gemfile 解决:sudo ge ...

  6. SQL 关联操作

  7. appium(1)-about appium

    about appium Introduction to Appium Appium is an open-source tool for automating native, mobile web, ...

  8. Codeforces Round #295 (Div. 2)---B. Two Buttons( bfs步数搜索记忆 )

    B. Two Buttons time limit per test : 2 seconds memory limit per test :256 megabytes input :standard ...

  9. WebDriver API——浏览器控制暨如何学习webdriver API

    在测试过程中我们可能需要对浏览器进行控制,大小控制啊,刷新页面啊,前进后退等等,最常用的两个接口是window和Navigation. 我们最常用的就是这4个,那么你是否感兴趣它们后面是什么,它们是怎 ...

  10. BZOJ 1619 [Usaco2008 Nov]Guarding the Farm 保卫牧场:dfs【灌水】

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1619 题意: 给你一个n*m的地形图,位置(x,y)的海拔为h[x][y]. 一个山顶的定 ...