apache / apache/netbeans

VM options in maven project properties used by "run project" action but not by "run file via main()" action

Open
#7,711 3 comments 0 reactions 1 assignee Claimed by @sdedic View on GitHub
kind:bug Maven needs:triage
Dominant language
Java
Stars
3.1k
Forks
935
Avg merge
2d 3h
Merged PRs (30d)
17

Description

### Apache NetBeans version

Apache NetBeans 22

### What happened

When you define a VM option in the properties of a maven project, this option is copied into the exec.vmArgs parameter of the “run project” action, but not into the same parameter of the “run file via main()” action.

### Language / Project Type / NetBeans Component

Java Application Maven Project

### How to reproduce

A particularly painful example:
Under Windows, there is an incompatibility between the netbeans console and the output of a program defined by a “java with maven; java application” project:
1) Create a new “java with maven; java application”
2) in the main method automaticaly generated, change "Hello World!" by "déjà"
3) run the project (F6)
==> you get in the netbeans output console : d�j�
4) go to project properties ; run ; vm options and add -Dstdout.encoding=UTF-8
5) run again the project (F6)
==> you get in the netbeans output console : déjà
6) now run the file (shift-F6)
==> you get in the netbeans output console : d�j�
there is a notable difference between running the project and running the current file (containing a class with a main method)

You can see the difference by opening “Actions” in the project properties and successively selecting the actions “run project” and “run file via main()”.
Under "run projet" you have : exec.vmArgs=-Dstdout.encoding=UTF-8
Under "run file via main()" you have only : exec.vmArgs= (empty)

it's the same for “debug project” and “debug file by main()”.

### Did this work correctly in an earlier version?

No / Don't know

### Operating System

Windows 11

### JDK

java version "22" 2024-03-19 Java(TM) SE Runtime Environment Oracle GraalVM 22+36.1 (build 22+36-jvmci-b02) Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 22+36.1 (build 22+36-jvmci-b02, mixed mode, sharing)

### Apache NetBeans packaging

Apache NetBeans provided installer

### Anything else

_No response_

### Are you willing to submit a pull request?

No

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.