You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "insastrasbge1 (via GitHub)" <gi...@apache.org> on 2024/08/29 13:44:07 UTC

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

insastrasbge1 opened a new issue, #7711:
URL: https://github.com/apache/netbeans/issues/7711

   ### 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


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] VM options in maven project properties used by "run project" action but not by "run file via main()" action [netbeans]

Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on issue #7711:
URL: https://github.com/apache/netbeans/issues/7711#issuecomment-2317746718

   Yes, the `Run` section is just a shortcut to setting up some of the actions.  If you set the actions directly, you'll notice the Run section gets disabled.
   
   You might want to set up environment variables on your system for this anyway - see comments on #4261  Welcome to the joys of encoding on Windows!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] VM options in maven project properties used by "run project" action but not by "run file via main()" action [netbeans]

Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on issue #7711:
URL: https://github.com/apache/netbeans/issues/7711#issuecomment-2317830910

   the project run config is specific to the main entry point of the project. This is used when the the project run button is pressed.
   
   The run-single action simply tries to run the selected file, it won't use the project config.
   
   You can add more run actions with arbitrary configs via nbactions.xml
   looks like this:
   ```xml
       <action>
           <actionName>CUSTOM-custom custom codec</actionName>
           <displayName>custom exec</displayName>
           <goals>
               <goal>exec:java</goal>
           </goals>
           <properties>
               <xec.mainClass>dev.mbien.mavenproject3.Mavenproject3</xec.mainClass>
               <stdout.encoding>US-ASCII</stdout.encoding>
           </properties>
       </action>
   ```
   this will appear under the "Run Maven" context menu.
   
   I don't know if you can add properties to the run-single action, I never tried doing that so far.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: [I] VM options in maven project properties used by "run project" action but not by "run file via main()" action [netbeans]

Posted by "insastrasbge1 (via GitHub)" <gi...@apache.org>.
insastrasbge1 commented on issue #7711:
URL: https://github.com/apache/netbeans/issues/7711#issuecomment-2317727404

   Workaround :
   you can fix the problem manually by going to project properties ; Actions ; “run file via main()” and add -Dstdout.encoding=UTF-8 (or any other vm options) to exec.vmArgs (the first line becomes exec.vmArgs=-Dstdout.encoding=UTF-8)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists