Unable to print in command line(built)

I was trying to build a command line application that prints in the command line(windows) but print(); and println(); don’t do anything in the CMD, is there anyway to do that?
(it is probably very obvious but I am noob and i won’t probably be here when you answer(blame school))

Can you post an example program that demonstrates the problem you’re having?

One possible solution that I use is to first create a text file (MyFile.txt) containing the text I want to print to the PCs default printer. Then I use the ‘launch’ command to launch windows Notepad.exe with the ‘/p’ option as shown in the example below:

launch(notepad.exe /p C:/Users/Bill/MyFile.txt);

I use this approach to print to a thermal receipt printer but it will work with any printer that is set as your default printer.

1 Like
void draw() {
println("hello world");
}

but then built as exe and accessed from cmd.

No in the console. like println();

Using println() should work fine in an exported application. How are you running the application?

Like in cmd: helloworld
(windows)

Sorry, I’m still not really sure what you’re trying to do. Can you post exactly what you’re doing, step-by-step? Maybe include some screenshots.

You should be able to export a Processing application and run it via the command line just fine, and I would expect print statements to show up in the command line if you run it that way.

Can you please post exactly how you’re running it, so we can see which step might be tripping you up?

I am running it when built on windows like this:
in cmd like this:
cd C:/…\Processing\sketch_181020a\application.windows32
an then
sketch_181020a
or
sketch_181020a.exe
or
start sketch_181020a.exe

they all launch but do not print in cmd
inside sketch:
void draw() {
print("HelloWorld");
}

and it does print in the processing console

Where is the .exe file coming from? As far as I know, Processing doesn’t export any .exe files.

I just tested this example sketch:

void setup(){
  println("hello");
}

Exporting to an application (which is really just a run file and some .jar files) and then running via the command prompt does indeed print out “hello” for me.