I've created a java GUI that executes batch files in order to easily and seamlessly command a serial com port device.
try {
Process p = Runtime.getRuntime().exec("toggleLed.bat");
} catch(Exception e) {
e.printStackTrace();
}
This code executes the following .bat file:
@ECHO OFF
ECHO A >COM1
EXIT
This code sends the letter "A" over com port 1 and the device interprets it as a command and turns on the LED, works perfectly. The only problem is, I want to be able to change the COM port via the java GUI. I have a "jSpinner" but I'm not sure how to get this to edit the com port value in the batch file.
Question: How do I get my java GUI to edit a batch file value?
PS: I'm using batch files to communicate over serial because I have tried numerous libraries such as RXTX but none of them work well/are too complicated.