Doubt in build.xml file in Apache-Ant1.6.5 - java

I have used Collections in my code with Generics. When try to compile that java file in build.xml, its showing error at generics and its saying its not a statement. I am using Apache-Ant-1.6.5 and i have installed JDK 1.5 only . I know generic will support in jdk1.5 but its showing error. The below is the error i am getting for the code
code :
Map<String, String> inputconfigmap =
new LinkedHashMap<String, String>();
Exception :
compile:
[mkdir] Created dir: D:\GenericPreProcessor\Source\classes
[javac] Compiling 49 source files to D:\GenericPreProcessor\Source\classes
[javac] D:\GenericPreProcessor\Source\src\com\dnb\genericpreprocessor\fileprocessor\FixedLength
FileProcessor.java:187: not a statement
[javac] Map<String, String> inputconfigmap =
new LinkedHashMap<String, String>();
I did as per your suggestion but i got the following in the console.
Console :
D:\GenericPreProcessor\Source>ant
Buildfile: build.xml
[echo] JVM version is 1.5
[echo] Target compilation is ${ant.build.javac.target}
clean:
[delete] Deleting directory D:\GenericPreProcessor\Source\classes
cleanJar:
compile:
[mkdir] Created dir: D:\GenericPreProcessor\Source\classes
[javac] Compiling 49 source files to D:\GenericPreProcessor\Source\classes
[javac] javac: invalid target release: 1.5
[javac] Usage: javac
[javac] where possible options include:
[javac] -g Generate all debugging info
[javac] -g:none Generate no debugging info
[javac] -g:{lines,vars,source} Generate only some debugging info
[javac] -nowarn Generate no warnings
[javac] -verbose Output messages about what the compiler is doing
[javac] -deprecation Output source locations where deprecated APIs are used
[javac] -classpath Specify where to find user class files
[javac] -sourcepath Specify where to find input source files
[javac] -bootclasspath Override location of bootstrap class files
[javac] -extdirs Override location of installed extensions
[javac] -d Specify where to place generated class files
[javac] -encoding Specify character encoding used by source files
[javac] -source Provide source compatibility with specified release
[javac] -target Generate class files for specific VM version
[javac] -help Print a synopsis of standard options
BUILD FAILED

Have you tried explicitly setting the source and target attributes for your javac task?
<target name="compile">
<javac .....
source="1.6"
target="1.6" />
</target>

Maybe you can check the version of your compilator with :
<echo>JVM version is ${ant.java.version}</echo>
<echo>Target compilation is ${ant.build.javac.target}</echo>
And you can add <property name="ant.build.javac.target" value="1.5" /> to force the compiler to use Java 5 compliance...
This property is the default target from ant 1.7, for ant 1.6 I think you must add target="${ant.build.javac.target}" to your javac target.

You need to define the type of the Map, i.e:
Map<String, String> inputconfigmap = new LinkedHashMap<String, String>();

Try
Map<?, ?> inputconfigmap = new LinkedHashMap<?, ?>();

Are you using double angle brackets (<< and >>)? They should be single ones as kgiannakakis showed:
Map<String, String> inputconfigmap = new LinkedHashMap<String, String>();

Related

JDK 11 compiling class files fails with OOM exception

[Edit] This is no longer an issue. Did not change anything except using the current JDK11.
Updated jar dependencies for jdk 11 compliance.
Updated ant to 1.10.x.
Changed ANT_OPTS to use upto 5GB of memory.
Changed the javac task inside build script to use upto 5GB of memory and fork=true.
I get the following error:
[javac] Compiling 909 source files to C:\xyz\build\classes
[javac]
[javac]
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at jdk.zipfs/jdk.nio.zipfs.ZipPath.relativize(ZipPath.java:226)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:525)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer$1.preVisitDirectory(JavacFileManager.java:521)
[javac] at java.base/java.nio.file.Files.walkFileTree(Files.java:2731)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager$ArchiveContainer.<init>(JavacFileManager.java:520)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.getContainer(JavacFileManager.java:316)
[javac] at jdk.compiler/com.sun.tools.javac.file.JavacFileManager.list(JavacFileManager.java:712)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.list(ClassFinder.java:734)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.scanUserPaths(ClassFinder.java:678)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.fillIn(ClassFinder.java:551)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder.complete(ClassFinder.java:299)
[javac] at jdk.compiler/com.sun.tools.javac.code.ClassFinder$$Lambda$42/0x00000008000d6040.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab.lambda$addRootPackageFor$8(Symtab.java:780)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symtab$$Lambda$44/0x00000008000d5840.complete(Unknown Source)
[javac] at jdk.compiler/com.sun.tools.javac.code.Symbol.complete(Symbol.java:642)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.visitTopLevel(Enter.java:355)
[javac] at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCCompilationUnit.accept(JCTree.java:529)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:286)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.classEnter(Enter.java:301)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.complete(Enter.java:576)
[javac] at jdk.compiler/com.sun.tools.javac.comp.Enter.main(Enter.java:560)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:1066)
[javac] at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:937)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:311)
[javac] at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
[javac] at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
[javac] at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
Note : This same setup continues to build fine under java 8
Update 1:
Running ant with -verbose and the javac in the build file with verbose provides the search path that is used. Comparing thejdk8 and jdk11 entries :
JDK8 had the following entries that wern't present in jdk 11 search path
c:\jdk1.8.0_152\jre\lib\resources.jar
c:\jdk1.8.0_152\jre\lib\rt.jar
c:\jdk1.8.0_152\jre\lib\sunrsasign.jar
c:\jdk1.8.0_152\jre\lib\jsse.jar
c:\jdk1.8.0_152\jre\lib\jce.jar
c:\jdk1.8.0_152\jre\lib\charsets.jar
c:\jdk1.8.0_152\jre\lib\jfr.jar
c:\jdk1.8.0_152\jre\classes
c:\jdk1.8.0_152\jre\lib\ext\access-bridge-64.jar
c:\jdk1.8.0_152\jre\lib\ext\cldrdata.jar
c:\jdk1.8.0_152\jre\lib\ext\dnsns.jar
c:\jdk1.8.0_152\jre\lib\ext\jaccess.jar
c:\jdk1.8.0_152\jre\lib\ext\jfxrt.jar
c:\jdk1.8.0_152\jre\lib\ext\localedata.jar
c:\jdk1.8.0_152\jre\lib\ext\nashorn.jar
c:\jdk1.8.0_152\jre\lib\ext\sunec.jar
c:\jdk1.8.0_152\jre\lib\ext\sunjce_provider.jar
c:\jdk1.8.0_152\jre\lib\ext\sunmscapi.jar
c:\jdk1.8.0_152\jre\lib\ext\sunpkcs11.jar
c:\jdk1.8.0_152\jre\lib\ext\zipfs.jar
c:\jdk1.8.0_152\lib\tools.jar
C:\SourceRepo\xx\yy\
The last line is the root of the project where the build.xml exists.
After the search path, there are a bunch of "loading ZipFileIndexFileObject...".
Followed by class file generation of my classes.
Followed by putting them in a jar.
The entries in jdk11 that were missing in the jdk8 search path.
C:\jdk-11\lib\modules
The above modules doesn't exist.
And then it fails with OOM stacktrace as listed earlier.
Update 2 Oct 17'2018:
Got an openjdk11 docker image (linux), installed ant on it, mounted my source directory and did an ant build. Worked fine no issues. So it seems like a windows jdk11 issue to me right now.

JADE Agent Integration with WSIG

installed all neccesary pre-requisite for integrating web service with jade. when trying to test out the wsig jade-addon with ant in command prompt like this
>ant deploy-examples
it loads up and shows 100 errors , tried different things(The Logger Keeps Popping As Error). Please need serious help as it is a huge project for me.Thanks
Here is the console error
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
C:\Users\THEOPHY>cd C:\jade\add-ons\wsig
C:\jade\add-ons\wsig>ant deploy-examples
Buildfile: C:\jade\add-ons\wsig\build.xml
init:
[echo] JAVA_HOME C:\Program Files\Java\jdk1.8.0_51
[echo] CATALINA_HOME C:\juddi
[echo] source dir C:\jade\add-ons\wsig\src
[echo] build dir C:\jade\add-ons\wsig\webModule\WEB-INF\classes
[echo] OS platform is Windows 8
SubWCRev:
compile:
[javac] Compiling 46 source files to C:\jade\add-ons\wsig\webModule\WEB-INF\classes
[javac] warning: [options] bootstrap class path not set in conjunction with -source 1.5
[javac] warning: [options] source value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] target value 1.5 is obsolete and will be removed in a future release
[javac] warning: [options] To suppress warnings about obsolete options, use -Xlint:-options.
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:49: error: cannot find symbol
[javac] private static Logger logger = Logger.getMyLogger(WSIGConfiguration.class.getName());
[javac] ^
[javac] symbol: method getMyLogger(String)
[javac] location: class Logger
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:67: error: cannot find symbol
[javac] public static final String KEY_WSIG_PRESERVE_JAVA_TYPE = SLCodec.PRESERVE_JAVA_TYPES;
[javac] ^
[javac] symbol: variable PRESERVE_JAVA_TYPES
[javac] location: class SLCodec
[javac] C:\jade\add-ons\wsig\src\com\tilab\wsig\WSIGConfiguration.java:184: error: cannot find symbol
[javac] return getProperty(jade.core.Profile.LOCAL_PORT);
[javac] ^
[javac] symbol: variable LOCAL_PORT
[javac] location: class Profile
I think it has to do with what version of java it is attempting to target. As you can see there are some warnings that indicate source and target are obsolete. What I had to do to get this working is simply delete the references to the source and target in the build.xml to force it to use a default value.
For example change:
<target name="compile" depends="init,SubWCRev" description="Compile WSIG sources">
<javac srcdir="${wsigSrc.dir}"
debug="${debug-build}"
destdir="${wsigBuild.dir}"
encoding="ISO-8859-1"
optimize="${optimised-build}"
includeAntRuntime="no"
target="1.5"
source="1.5">
<classpath refid="wsigCompile.classpath"/>
</javac>
<echo>Compilation complete</echo>
</target>
to this:
<target name="compile" depends="init,SubWCRev" description="Compile WSIG sources">
<javac srcdir="${wsigSrc.dir}"
debug="${debug-build}"
destdir="${wsigBuild.dir}"
encoding="ISO-8859-1"
optimize="${optimised-build}"
includeAntRuntime="no">
<classpath refid="wsigCompile.classpath"/>
</javac>
<echo>Compilation complete</echo>
</target>

Change source from 1.5 to 1.7 (Using the cocos command line tool)

I am trying to compile my android project using the following command line:
cocos deploy -p android -m release
But i keep getting some errors saying the following:
error: diamond operator is not supported in -source 1.5
I tried manually modifying the individual files to fix the declaration so that it doesnt depend on 1.7, but after i did it many many errors appeared (the diamond operator one got fixed thought). So what i am thinking is that i need to make cocos compile it directly with 1.7 instead.
But i have looked for it everywhere and i can't find where to change that.
I am not using eclipse, nor android studio, i am using the terminal directly with the cocos commands.
Does anyone have any idea about where this is changed?
Update:
It has something to do with the java compiler, but still can't find where to change the javac settings:
[javac] /Users/LuisOscar/Documents/CocosProjects/Zombies/proj.android/src/net/nend/NendModule/NendIconModule.java:56: error: diamond operator is not supported in -source 1.5
[javac] private static HashMap<String, NendAdIconData> mNendAdIconHashMap = new HashMap<>();
[javac] ^
[javac] (use -source 7 or higher to enable diamond operator)
[javac] /Users/LuisOscar/Documents/CocosProjects/Zombies/proj.android/src/net/nend/NendModule/NendModule.java:51: error: diamond operator is not supported in -source 1.5
[javac] private static HashMap<String, NendAdViewData> mNendAdHashMap = new HashMap<>();
[javac] ^
[javac] (use -source 7 or higher to enable diamond operator)
I found the location, For anyone else interested this is adjusted at:
Android/android-sdk-macosx/tools/ant/build.xml
It's shown under compilation options:
<property name="java.target" value="1.7" />
<property name="java.source" value="1.7" />

compiling TuxGuitar on on OS X, javac can't find packages

I'm trying to compile TuxGuitar (a guitar tablature editor) on OS X. I've checked out the code from the TuxGuitar repository:
svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
Now, when I run make which in turn uses ant, it seems javac can't find Java packages within the project source tree. I've put the complete output of make at http://people.kth.se/~albertwi/tuxg-make-error; it's huge so I can't put all of it here in a code block.
I'm assuming this is a semi-trivial class path issue but I can't tell how to modify the build configuration. On line 307 and onward in the make output there are errors/warnings on the form of "some_file.java added as some_file.class doesn't exist", I don't know what this entails:
[javac] org/herac/tuxguitar/app/TGMain.java added as org/herac/tuxguitar/app/TGMain.class doesn't exist.
[javac] org/herac/tuxguitar/app/TuxGuitar.java added as org/herac/tuxguitar/app/TuxGuitar.class doesn't exist.
[javac] org/herac/tuxguitar/app/action/TGActionAccessInterceptor.java added as org/herac/tuxguitar/app/action/TGActionAccessInterceptor.class doesn't exist.
...
On line 715 and onward some class paths are included, but it seems like not all the necessary folders are appended here (the TuxGuitar source tree contains folders on the form TuxGuitar-some program component/src/org/herac/tuxguitar, for example TuxGuitar-ascii/src/org and TuxGuitar-fluidsynth/src/org which I believe should be included here but they aren't):
[javac] Compilation arguments:
[javac] '-d'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build'
[javac] '-classpath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/build:/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar:/opt/local/share/java/apache-ant/lib/ant-launcher.jar:/opt/local/share/java/apache-ant/lib/ant-antlr.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bcel.jar:/opt/local/share/java/apache-ant/lib/ant-apache-bsf.jar:/opt/local/share/java/apache-ant/lib/ant-apache-log4j.jar:/opt/local/share/java/apache-ant/lib/ant-apache-oro.jar:/opt/local/share/java/apache-ant/lib/ant-apache-regexp.jar:/opt/local/share/java/apache-ant/lib/ant-apache-resolver.jar:/opt/local/share/java/apache-ant/lib/ant-apache-xalan2.jar:/opt/local/share/java/apache-ant/lib/ant-commons-logging.jar:/opt/local/share/java/apache-ant/lib/ant-commons-net.jar:/opt/local/share/java/apache-ant/lib/ant-jai.jar:/opt/local/share/java/apache-ant/lib/ant-javamail.jar:/opt/local/share/java/apache-ant/lib/ant-jdepend.jar:/opt/local/share/java/apache-ant/lib/ant-jmf.jar:/opt/local/share/java/apache-ant/lib/ant-jsch.jar:/opt/local/share/java/apache-ant/lib/ant-junit.jar:/opt/local/share/java/apache-ant/lib/ant-junit4.jar:/opt/local/share/java/apache-ant/lib/ant-netrexx.jar:/opt/local/share/java/apache-ant/lib/ant-swing.jar:/opt/local/share/java/apache-ant/lib/ant-testutil.jar:/opt/local/share/java/apache-ant/lib/ant.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/lib/tools.jar'
[javac] '-sourcepath'
[javac] '/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src'
...
Then on line 1143 and onward I get "package org.herac.tuxguitar.some package does not exist" errors:
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:27: error: package org.herac.tuxguitar.action does not exist
[javac] import org.herac.tuxguitar.action.TGActionManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:68: error: package org.herac.tuxguitar.document does not exist
[javac] import org.herac.tuxguitar.document.TGDocumentManager;
[javac] ^
[javac] /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/src/org/herac/tuxguitar/app/TuxGuitar.java:69: error: package org.herac.tuxguitar.event does not exist
[javac] import org.herac.tuxguitar.event.TGEvent;
[javac] ^
...
I'm not well versed in make and ant. How and where do I make configuration changes so javac can find the packages?
Is the problem so involved that I should ask TuxGuitar developers about this instead?
Update: I tried using another way of compiling as suggested at https://sourceforge.net/p/tuxguitar/discussion/522984/thread/3843b30b/#1ce9, so I go to a folder build-scripts/tuxguitar-macosx-cocoa-64 and run mvn clean package -Dnative-modules=true but then I get errors related to SWT... this, essentially (full output at http://people.kth.se/~albertwi/tuxg-mvn-error):
[INFO] Scanning for projects...
[ERROR] The build could not read 18 projects -> [Help 1]
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. # org.herac.tuxguitar:tuxguitar:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar/pom.xml, line 26, column 15
[ERROR]
[ERROR] The project org.herac.tuxguitar:tuxguitar-browser-ftp:1.3-SNAPSHOT (/Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml) has 1 error
[ERROR] 'dependencies.dependency.version' for org.eclipse.swt:org.eclipse.swt:jar is missing. # org.herac.tuxguitar:tuxguitar-browser-ftp:[unknown-version], /Users/awifstrand/src/tuxg/tuxguitar-code/TuxGuitar-browser-ftp/pom.xml, line 35, column 15
[ERROR]
...
I have the latest version (4.4) of swt.jar in /Library/Java/Extensions so it should be on the class path.
I got into the same trouble, it looks like the Makefile is broken as it uses ant instead of maven.
Here are the steps I did (Thanks to my colleage Clément which was born with java while I was with punch cards):
$svn checkout svn://svn.code.sf.net/p/tuxguitar/code/trunk tuxguitar-code
$sudo apt-get install maven
$cd tuxguitar-code
$uname -a
Linux acacia 3.16-3-amd64 #1 SMP Debian 3.16.5-1 (2014-10-10) x86_64 GNU/Linux
$cd build-scripts/tuxguitar-linux-x86_64
$rehash
$mvn clean package
$cd target
$cd tuxguitar-1.3-SNAPSHOT-linux-x86_64
$./tuxguitar.sh
This did work for me on 3 different computers, all debian based though.
Hope this helps

javac: java.lang.OutOfMemoryError when running ant from Eclipse

I have given loads of memory to eclipse in the ini file but its still not using anything more than 300mb which i can see in the task manager.
[javac] The system is out of resources.
[javac] Consult the following stack trace for details.
[javac] java.lang.OutOfMemoryError: Java heap space
[javac] at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1938)
[javac] at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
[javac] at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
[javac] at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
[javac] at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
[javac] at com.sun.tools.javac.comp.Annotate.enterAttributeValue(Annotate.java:190)
[javac] at com.sun.tools.javac.comp.Annotate.enterAnnotation(Annotate.java:167)
[javac] at com.sun.tools.javac.comp.MemberEnter.enterAnnotations(MemberEnter.java:743)
[javac] at com.sun.tools.javac.comp.MemberEnter.access$300(MemberEnter.java:42)
[javac] at com.sun.tools.javac.comp.MemberEnter$5.enterAnnotation(MemberEnter.java:711)
[javac] at com.sun.tools.javac.comp.Annotate.flush(Annotate.java:95)
[javac] at com.sun.tools.javac.comp.Annotate.enterDone(Annotate.java:87)
[javac] at com.sun.tools.javac.comp.Enter.complete(Enter.java:485)
[javac] at com.sun.tools.javac.comp.Enter.main(Enter.java:442)
[javac] at com.sun.tools.javac.main.JavaCompiler.enterTrees(JavaCompiler.java:819)
[javac] at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:353)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:279)
[javac] at com.sun.tools.javac.main.Main.compile(Main.java:270)
[javac] at com.sun.tools.javac.Main.compile(Main.java:69)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[javac] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
[javac] at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1065)
[javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:882)
[javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[javac] at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
[javac] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[javac] at java.lang.reflect.Method.invoke(Method.java:597)
[javac] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
this is my ini file which i have.
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
512M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize1024m
--vm
C:\Program Files\Java\jdk1.6.0_24\bin\javaw.exe -vmargs -Xms512m -Xmx1024m
I have no idea why it wont use the memory I am giving it. Do i need to do anything else to change the heap size?
Thanks
Not Eclipse is running out of memory, but ant. Ant is run as an external tool from eclipse, so it does not inherit the VM settings you are using for eclipse. You can set the options for it in the external tool run configuration. Go to Run -> External Tools -> External Tool Configurations... Then under "Ant Builds" you have to look up your ant build, and you can set the vm arguments in the JRE tab.
your eclipse.ini settings will take effect only if u change following:
Run -> External Tools -> External Tool
Configurations. go to configuration that u use, under jre tab -select option
Run in same JRE in workspace
this worked 4 me
See this topic with best Eclipse JVM settings
You can properly set the -Xms512m -Xmx1024m options to the Ant bin/sh script that Eclipse will run once you launch a build.
Go to your Eclipse folder
Go to plugins > org.apache.ant_<version> > bin
Modify the OS related Ant file
For Windows: Add this line to the ant.bat file export ANT_OPTS=-Xmx512m
For Unix/Mac OS X: You can directly edit the ant_exec_command command at the end of the ant file or setting the $ANT_ARGS variable
I had the same problem a week ago, and the solution was set fork attribute to true, to run javac in a separate process with its own heap size settings.
If fork is set to false, or not set (default is false), javac will run in the same process as Ant. The following is a snippet from my current build.xml:
<javac fork="true"
srcdir="${basedir}/src"
.....
</javac>
Setting fork to true will also limit any memory leaks in javac implementation to its own child process, without affecting the parent Ant process.
I read about this hint here

Categories

Resources