Reputation: 1530
I have a Netbeans Platform modular project, not a regular Java project. I want to set VM options to increase memory, but under the "properties" dialog, there is no way to do this for a modular Netbeans platform project. This has cost me huge amounts of time and I still have not found a good way to set the VM args.
Does anyone know how to set VM args using a Netbeans platform modular project, when compiling and running the program in Netbeans 7? Given the amount of trouble, I am almost ready to give up on Netbeans to create modular applications.
Upvotes: 17
Views: 42075
Reputation: 1530
I was finally able to solve this based on information at https://web.archive.org/web/20130830023832/http://activeintelligence.org/blog/archive/gephi-increasing-xmx-memory-in-netbeans/
What I did was modify the project.properties file, as JB said, but the correct way to do it was to add a -J before the args. E.g.,
run.args.extra=-J-Xms256m -J-Xmx756m
That did it! Not sure why it took 3 months to figure that out. Definitely a fail for the Netbeans documentation. They should really make this editable from the properties menu instead of making users hunt through nondescript config files!
Upvotes: 8
Reputation: 16628
If you want to use Netbeans to set the VM options without bothering about which file to edit, here we go:
Run -> Set project configuration -> VM Options
Add your option in the corresponding text box for example: -Xms10m
To answer user1156544
doubt:
Upvotes: 2
Reputation: 176
you have to add these lines to your project properties file.
<target name="build-launchers" depends="suite.build-launchers">
<replace file="build/launcher/etc/${app.name}.conf" token="--branding graphsimulator -J-Xms24m -J-Xmx64m" value="--branding graphsimulator -J-Xms128m -J-Xmx512m"/>
</target>
Upvotes: 1
Reputation: 7830
As described in this question, you can use etcConfFile parameter of nbm-maven-plugin:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>nbm-maven-plugin</artifactId>
<configuration>
<etcConfFile>src/main/resources/app.conf</etcConfFile>
</configuration>
</plugin>
More info: Geertjan's Blog
Upvotes: 2
Reputation: 97
I had this issue and after some digging around and reading a lot of docs I was able to deduce that most of those values were coming from templates in the harness.
So if you go to your IDE_home/harness/etc/ you will find the "app.conf" file. This file is renamed during a distro build and the "app.conf" becomes your "application name.conf". Edit this file with the default values you would like in you application.
In my case I replaced the line that read: default_options="--branding ${branding.token} -J-Xms24m -Xmx64m" with default_options="--branding ${branding.token} -J-Xms64m -Xmx512m" as my application was needing more memory. By changing the template I dont have to touch every deployment and change the memory CLI for the VM.
Hope this helps!
Upvotes: 3
Reputation: 51
I thought i'll put some contribution on this topic, When I was developing a netbeans platform application i also faced the same problem, I added run.args.extra=-J-Xmx768m and updated my project.properties file but it didn't ! But when i added run.args.extra=-J-Xmx768m in my platform.properties file then it worked, again this only works when i was in development environment. When I packeged the application for windows the problem remained same my min heap size was 24m and max is 64m. Then I found out that if I update and add default_options="--branding my_project -J-Xms64m -J-Xmx1G" in my_project.conf in my installed directory C:\Program Files\my_project\etc then run my application and checked the ide log i can now see the change. By the way i wasn't lucky enough to see even the run node when i right click and go to the project properties dialogue in netbeans 7.0.1. Its upto netbeans dream team to make us feel lucky.
Upvotes: 5
Reputation: 2670
It is quite easy, in fact. Just modify project.properties file to include the following line:
Edited:
run.args.extra=-J-Xmx768m
Of course, you can include any other JVM options there.
Enjoy.
Upvotes: 12