Introduce inputs in exec node

Hello!!
I'm trying to execute a Java program from node-red in my raspberry pi that consists on entering a name so that it can be displayed as an output, and I wonder how can I introduce the input that I want (the name Mickey Mouse for example), in the exec node so that it can be sent to the program without getting an error, and the output can be displayed: "Welcome Mickey Mouse". This is the flow I'm working on and the java program that is being executed is SalsaHoy.java, which already works by itself on the Raspberry Pi but not when it is called from node-red with this flow:

[{"id":"ae4103fa.c2bc","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"7d8029c6.f1c028","type":"exec","z":"ae4103fa.c2bc","command":"cd Java && javac SalsaHoy.java && java SalsaHoy","addpay":false,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Execute SalsaHoy.java","x":610,"y":380,"wires":[["2b6a9acd.0d3736"],[],[]]},{"id":"2b6a9acd.0d3736","type":"debug","z":"ae4103fa.c2bc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":830,"y":380,"wires":[]},{"id":"1a3c269a.9341a9","type":"inject","z":"ae4103fa.c2bc","name":"","topic":"","payload":"Mickey Mouse","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":380,"y":380,"wires":[["7d8029c6.f1c028"]]}]

Thank you in advance!!

Click on node and then read the info tab (in the sidebar)

And how do I append the input to the command?

Also would help too if anybody could tell me how to run 2 commands that must be run at different times but with the same exec node!

Thank you all!!

Look at the node’s options

If you have to run two different commands, why can you use two nodes?

Because the second one is not actually a command, it´s the input Mickey Mouse, which I want the program to receive and present the final Output with: "Welcome Mickey Mouse"

Please edit your first post and fixed your code. Add a line with three back tic's () on the next line start your code and then add a line after your code with three back tics ()

In your exec node you are not executing one command but three! (that would have been helpful for you to explain in your initial post)
cd Java
javac SalsaHoy.java
java SalsaHoy
so you are changing the directory, compiling the program and running it.

Since only the last one needs the argument, you might still be able to append the argument to the commands.

Did you read the exec node's info tab and look at it's options?

Thanks four your help, I'm not familiar with Node-red and I'm having trouble, I have checked the info tab of the exec node but I haven't found how to append the input in the command... Do you know??

please edit your first post after reading this thread: How to share code or flow json

Since you have read the info tab for the exec node, please copy and paste the section that talks about adding parameters to the command

I get this error, do you know what it means??

 "Command failed: javac SalsaHoy.java && java SalsaHoy "Mickey"↵Exception in thread "main" java.lang.NullPointerException↵→at SalsaHoy.main(SalsaHoy.java:6)↵"

Only what google says

@dceejay Dave can you link commands using the exec node and pass in an argument?

This is my flow:

[{"id":"2b4acc66.585234","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"5db1d847.7d50b8","type":"debug","z":"2b4acc66.585234","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":910,"y":400,"wires":[]},{"id":"843dc9e6.098f88","type":"inject","z":"2b4acc66.585234","name":"","topic":"","payload":"\"Mickey\"","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":380,"y":400,"wires":[["99aff280.ad6f9"]]},{"id":"99aff280.ad6f9","type":"exec","z":"2b4acc66.585234","command":"javac SalsaHoy.java && java SalsaHoy","addpay":true,"append":"","useSpawn":"false","timer":"","oldrc":false,"name":"Execute SalsaHoy.java","x":630,"y":400,"wires":[["5db1d847.7d50b8"],[],[]]}]

And this is my code:

import java.io.Console;  
	class SalsaHoy{    
		public static void main(String args[]){    
		Console c=System.console();    
		System.out.println("Enter your name: ");    
		String n=c.readLine();    
		System.out.println("Welcome "+n);    
		}    
	}

Iḿ executing this in a Raspberry PI 3 b+
Thank you in advance!!

Why are you doing this? You could have someone enter their name in a form in the dashboard and display the greeting on the dashboard using only node-red nodes.

Yes you can pass in any command string you like. You can create it using a function node or template if you wish.

But he is concatenation three commands together

Yeah no problem in Linux

Because I am trying to develop a communication between node-red and java, where you can enter inputs from node-red, execute the corresponding code in Java with the inputs sent from node-red and show the output back in the debug window in Node-red. So it is like this is a simple program to figure out how to send inputs from node-red to my program in java but i don know how...
How would it be done with a function or a template node? So I cannot do it with an inject node injecting a string with the input and then selecting the option "append to msg.payload" in the exec node?
Thanks again for your help

Your command will execute like:

javac SalsaHoy.java && java SalsaHoy <arguments from msg.payload>

Is this what you want ?

Yes please!! But if I do that this error comes out:

Command failed: cd Java/SalsaHoy && javac SalsaHoy.java && java SalsaHoy <arguments from msg.payload> "Mickey"
/bin/sh: 1: cannot open arguments: No such file

Or if I try the following command:

cd Java/SalsaHoy && javac SalsaHoy.java && java SalsaHoy <"Mickey">

The following error comes out:

Command failed: cd Java/SalsaHoy && javac SalsaHoy.java && java SalsaHoy <"Mickey">
/bin/sh: 1: Syntax error: end of file unexpected