I'm writing a Typescript programmatically in a Java based app. This produces a script.ts, which in normal Node js environment (whith Typescript installed) compiled and runs by:
tsc script.ts
My question is now: I can preinstall node js en Typescript on same server as the Java app, How can I then run from Java this script (mimic tsc script.ts)? And read the console log of it?
EDIT 1: I am trying to run the script.ts like following but encounter an error
p = Runtime.getRuntime().exec("tsc C:\\Users\\SK\\Documents\\Men\\HAI-main\\Executed\\script.ts");
Error:
Caused by: java.io.IOException: Cannot run program "tsc": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)