简体   繁体   English

JavaFX,Netbeans本机打包和在命令行上打印

[英]JavaFX, Netbeans native packaging and printing on the command line

I am writing a JavaFX application which I deploy directly via Netbeans: right click on project->package as->image only . 我正在编写直接通过Netbeans部署的JavaFX应用程序: right click on project->package as->image only

This works perfectly fine. 这工作得很好。 I need to implement a command line interface with several parameters and of course I want a '-h' option that prints the help onto the command line. 我需要使用几个参数来实现命令行界面,当然我需要一个“ -h”选项,该选项将帮助打印到命令行上。

I'm just using System.out.println() , nothing special. 我只是在使用System.out.println() ,没什么特别的。

This works totally fine as long as I do not deploy my code. 只要我不部署代码,此方法就可以正常工作。 Once I create the .exe file my output will no longer show any output on the console. 创建.exe文件后,我的输出将不再在控制台上显示任何输出。

What is happening in the background when deploying and how is it possible to get my output to the console? 部署时后台发生了什么?如何将输出输出到控制台?

I'm using Netbeans 8.2 and Java8. 我正在使用Netbeans 8.2和Java8。

This is not possible without a selfbuild executable ;) 没有自建可执行文件,这是不可能的;)

The native launcher/executable does not work that way, this is because windows-executables include whether they are CLI-applications or GUI-applications. 本机启动器/可执行文件不能以这种方式工作,这是因为Windows可执行文件包括CLI应用程序还是GUI应用程序。

For a more detailed answer see here: https://stackoverflow.com/a/34476175/1961102 有关更详细的答案,请参见此处: https : //stackoverflow.com/a/34476175/1961102

the generated EXE-file is a simple windows-executable, no cli-executable as seen in the launcher-source-code , that is the reason you dont see any console-output but having the result when pipelining into some file. 生成的EXE文件是一个简单的Windows的可执行文件,没有CLI-可执行文件显示在发射器源代码 ,这是你没有看到任何控制台输出,但流水线到一些文件的时候有结果的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM