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 240348 - During run of project -Dfile.encoding=<source-encoding> is implicitly passed as a VM Option
Summary: During run of project -Dfile.encoding=<source-encoding> is implicitly passed ...
Alias: None
Product: java
Classification: Unclassified
Component: Project (show other bugs)
Version: 8.0
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Tomas Zezula
Depends on:
Reported: 2014-01-12 17:27 UTC by swpalmer
Modified: 2014-01-14 16:28 UTC (History)
0 users

See Also:
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description swpalmer 2014-01-12 17:27:17 UTC
Product Version: NetBeans IDE 8.0 Beta (Build 201401091443)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b63
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b121
System: Mac OS X version 10.9.1 running on x86_64; UTF-8; en_US (nb)

The source encoding should be used only for compiling.  It should not be applied when running or debugging the project.

Instead we see that

... whatever value is selected on the Project's "Sources" section as the "Encoding:" is passed during a project "Run"

To reproduce:
Make a Java or JavaFX project.
        RuntimeMXBean rmxb = ManagementFactory.getRuntimeMXBean();
        List<String> vmargs = rmxb.getInputArguments();
        for (String arg : vmargs) { System.out.println(arg); }

to main, or start method.

Observe that the "file.encoding" property is being set as a VM option.
Comment 1 Tomas Zezula 2014-01-13 09:29:27 UTC
The runtime encoding is set to the value of property runtime.encoding.
You can define it in your (private|project).properties when it differs from source.encoding.
By default ${runtime.encoding} == ${source.encoding}.
The IDE needs to know the runtime encoding to be able to read stdout|stderr.
Comment 2 swpalmer 2014-01-13 19:45:58 UTC
Okay, I understand that it is good to be able to set the encode, but shouldn't the default be the system's default encoding?  If it is going to be set by NB always, shouldn't there be a field in the Run settings for it?

I was surprised to see this being set and it shouldn't be a surprise.
Comment 3 Tomas Zezula 2014-01-14 16:28:33 UTC
>shouldn't there be a field in the Run settings for it?
Currently there is not such a UI, you need to set the runtime.encoding in
Seems reasonable to me to add it into the UI.