0

I am writing a JavaFX application which I deploy directly via Netbeans: 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.

I'm just using System.out.println(), nothing special.

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.

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.

Mad Physicist
  • 107,652
  • 25
  • 181
  • 264
Thomas
  • 21
  • 1
  • 5
  • have a look at [System.console()](https://docs.oracle.com/javase/7/docs/api/java/io/Console.html) – TravisF Mar 06 '17 at 23:24
  • @TravisF native executables on windows systems do not work with command line output, see my answer below – FibreFoX Mar 07 '17 at 21:29
  • @FibreFoX I was more so thinking to relaying the console output to a textbox as the EXE is only a wrapper for the JavaFX, Java will still output to console just the EXE doesn't support the ability to show the console. – TravisF Mar 10 '17 at 05:08

1 Answers1

0

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.

For a more detailed answer see here: 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.

Community
  • 1
  • 1
FibreFoX
  • 2,858
  • 1
  • 19
  • 41