File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes What do I use instead of ANT_OPTS ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "What do I use instead of ANT_OPTS ?" Watch "What do I use instead of ANT_OPTS ?" New topic
Author

What do I use instead of ANT_OPTS ?

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm running Ant 1.6 through Eclipse 3.4 Ganymede on Win XP. I'm running into OutOfMemroyErrors when compiling and running my JUnit tests through Ant. I read that Eclipse does not pay attention to the "ANT_OPTS" argument. Where can I set the memory size for Ant within Eclipse?

Thanks, - Dave
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

Are your running Ant in a separate process or within Eclipse's process? If the former, then are you running Ant as a task or as a builder? Either way, there should be a JRE tab for the Ant run configuration properties - you can add the heap settings there. If you are running within the Eclipse process, then you can set heap size for Eclipse in eclipse.ini within the Eclipse home directory.

If this does not help, please state exactly how you are running Ant within Eclipse.


JBoss In Action
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
I don't know if I'm running as an Ant task or a builder. Here's what I'm doing ...

From Package Explorer view, right clicking on my build file, select "Run As" and then selecting "Ant Build".

Then I went to Window -> Preferences, and selected Ant -> Runtime, but I can't find the options you reference in there either ...

http://screencast.com/t/Vn93Bo0Gq

Any follow-up advice is much appreciated, - Dave
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

I think that running the Ant build that way runs it within Eclipse (that is, in the same JVM as Eclipse). So you would set the JVM options for Eclipse in eclipse.ini.

If you want to run Ant as a separate process, try this. Go to Project | Properties, then Builders and click New. Select Ant Builder, then in the Edit Configuration place your build.xml file in the Buildfile field on the Main tab, and then on the JRE tab select Separate JRE and add the JVM options in the VM Arguments field. Then back on the project Properties dialog,. unselect the other builder so that only the Ant builder is selected. Now any time you build the project it will use Ant in a separate process.
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
As as follow up to this, I increased my heap size but when I started Eclipse I got this screen

http://screencast.com/t/IZ5YNfIoLUK

I have 2 GB of RAM on my system so I'm not sure why the JVM is terminating with exit code = 1.

Thanks, - Dave
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5845
    
    7

You are setting the heap to 1GB and the permgen to 1/2GB. You are might be running out of memory (though when I set my memory too high I get a "Could not create Java virtual machine" dialog). Eclipse generates a log file for such an error, and it will have more details (I would tell you where it is, but I can't find the file).
 
 
subject: What do I use instead of ANT_OPTS ?