This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 43194

Summary: Cannot set VM parameters using j2seproject GUI
Product: java Reporter: pzajac <pzajac>
Component: ProjectAssignee: David Konecny <dkonecny>
Severity: blocker CC: dkonecny, jchalupa, jglick, mkubec, nathanaeljones, phrebejk, pjiricka
Priority: P2 Keywords: RELNOTE
Version: 4.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 41537    

Description pzajac 2004-05-13 11:02:13 UTC
Some usecase:
-X parameters (Disabling of hotspot, set memory size)
Set variables to JVM -Dneco= ...
Comment 1 David Konecny 2004-05-13 11:12:37 UTC
I guess you are talking about project execution???

You can customize build.xml. These options are not customizable in UI.
Comment 2 pzajac 2004-05-13 12:52:56 UTC
Typical user doesn't know how to customize build.xml script. 

Comment 3 Jesse Glick 2004-05-13 16:03:00 UTC
This and other possible customizations (system properties, etc.) were
intentionally omitted from the GUI. They are fairly easy to control in
build.xml and there will be instructions on how to do so for various
cases. We may include more such things in the GUI over time but I
think these are not planned for D.
Comment 4 David Konecny 2004-05-17 09:29:23 UTC
I will add some property through which this could be easily
customized. At the moment the user would have to override whole target.
Comment 5 Jesse Glick 2004-05-17 17:02:48 UTC
Note that customization of VM parameters and customization of system
properties are two different things.

Re. system properties, I have commented-out code in j2seproject's
build-impl.xsl showing how you could have them be autodefined given
the existence of project properties matching a certain pattern. Later
we could provide a GUI to set these if there is time.

Re. VM properties, I don't know of a clean way to make these
parametrizable in Ant, except by overriding the macrodef.
Comment 6 David Konecny 2004-05-17 18:26:41 UTC
I was thinking about using jvmargs attribute of <java>, but now I see
that it was deprecated; I thought about: always present
jvmargs="${jvm.extra.args}" where jvm.extra.args would be empty by

OK, for now user has to override run target. Something like:

<target name="run" depends="...">
 <j2seproject:java xmlns:j2seproject="...">
   <arg line="${application.args}"/>
   <jvmarg value="-X1..."/>
   <jvmarg value="-X2..."/>
Comment 7 Jesse Glick 2004-05-17 19:57:28 UTC
The problem with jvmargs is that it does not handle spaces or such
metacharacters cleanly. May not be critical, I don't know.
Comment 8 Jesse Glick 2004-06-15 13:41:48 UTC
There is now a property you can set, at least. No GUI for D. Should
consider for E.
Comment 9 pzajac 2004-06-15 14:01:27 UTC
IMHO, but it is for very advanced users. The settings of properties is
used in many java tutorials.  Write a few lines to ant script is easy
  for users who know how to work with antscript very well. For normal
users the build script of netbeans project is too dificult. We can do
UI study for this issue.  
Comment 10 David Konecny 2004-06-15 14:21:53 UTC
Current state is that newly created J2SE project has following
placeholder in

#space separated list of JVM args for VM in which the proj will run

So you do not have to override Ant targets now, just modify this property.

Second thing I implemented is that any property prefixed by
"run-sys-prop." is made available as system property to executed process.

Needs to be at least in user's documentation.
Comment 11 Jan Chalupa 2004-06-17 11:19:15 UTC
Would it be a big deal to expose run.jvmargs in the UI as a
single-line text field in the project properties customizer? I know
we're past the feature freeze, but it might be easy to do and make
lives of users easier. Just curious.
Comment 12 Jesse Glick 2004-06-17 16:46:42 UTC
Of course it would be easy to do; we only haven't because of feature
freeze, and lack of a proposed UI spec for it.

Note that you can also set system properties in
project/, using a different syntax (one Ant property
per system property). This is also not available in the GUI. The UI
for that would be somewhat more complicated since it would be some
kind of table of name/value pairs.

Of course you can use

  -Dname1=val1 -Dname2=val2

etc. in your VM args to set system properties, but this is less
desirable, in particular because you cannot include spaces in any of
the values (would be interpreted as multiple arguments).
Comment 13 Jesse Glick 2004-06-23 13:36:43 UTC
*** Issue 45431 has been marked as a duplicate of this issue. ***
Comment 14 Jesse Glick 2004-08-19 18:47:35 UTC
*** Issue 47504 has been marked as a duplicate of this issue. ***
Comment 15 clsimons 2004-08-26 12:20:28 UTC

I'd like to be able to turn execution of assertions on and off via 
the project UI. Setting 'run.jvmargs=-ea' in the 
file is far from obvious for the typical user.
Comment 16 David Konecny 2004-08-26 16:28:45 UTC
Two fields added to Running Project panel:
 * working directory
 * VM Options

Fixed in:
Checking in
new revision: 1.34; previous revision: 1.33
Checking in
new revision: 1.32; previous revision: 1.31
Checking in
new revision: 1.8; previous revision: 1.7
Checking in
new revision: 1.13; previous revision: 1.12
Checking in
new revision: 1.23; previous revision: 1.22
Comment 17 Jesse Glick 2004-08-27 03:30:14 UTC
Re. special GUI for assertions: sorry, not covered by this, not
planned for 4.0. You can just type "-ea" (or any of its many variants)
into the VM arguments field.
Comment 18 Milan Kubec 2004-08-27 14:06:13 UTC
Verified in dev-200408262030
Comment 19 David Konecny 2004-09-06 08:39:12 UTC
*** Issue 48504 has been marked as a duplicate of this issue. ***
Comment 20 nathanaeljones 2008-07-23 22:38:03 UTC
The GUI for jvmargs is not available on Web Projects in NetBeans 6! Is there another way to specify "-ea" for them?

asserts are *very* important for development. Why on earth does NetBeans disable them by default?
Comment 21 David Konecny 2008-07-23 23:49:19 UTC
Web Application is executed within an application server environment and so the options like -ea would have to be set
for your app server VM. I'm not sure how useful that would be; only applicable for a locally running app server I guess.
You can alter your app server startup params by hand. And possibly you could file issue for serverplugins component to
provide a UI for that in server customizer.
Comment 22 David Konecny 2008-07-23 23:57:07 UTC
nathanaeljones, you may want to add yourself to issue's CC list to be automatically notified about changes. You can read
my comment to your request in issue's description.
Comment 23 nathanaeljones 2008-07-24 03:54:56 UTC
I've tried setting the server vm options, but it doesn't seem to affect unit tests...

Where could I change the unit tests jvm args on a web project? On a class project they're changed in Project Properties>Run?

Thanks for your help!
Comment 24 David Konecny 2008-07-24 04:40:37 UTC
OK, you did not mention unit testing before. Well, unfortunately it is not supported. I filed separate issue for that
instead of reopening this one - issue 141464.