I have a jtextfield with a jbutton. I need to inject a java variable "jTextArea" (jtextfield) into a batch file and I'm trying to figure out the easiest way to accomplish this. The only thing I can think of is to somehow create the batch file from within the java program? Currently I have the batch file running onClick. Does anyone have any good ideas of how I can use a Java variable inside of a batch file?
Asked
Active
Viewed 145 times
0
-
3Modify the batch to take a parameter like shown here http://stackoverflow.com/questions/26551/how-to-pass-command-line-parameters-to-a-batch-file...then simply launch the batch like "file.bat variablehere" – cjones26 Jun 12 '15 at 17:07
1 Answers
1
Separate Java program and batch. Divide and conquer. Make Java program a controller which creates model(file) every time when variables change. Then batch process simply reads these files and uses these values.
But that the simplest way. Personally I'll do it more sophisticated. Make your Java the controller with GUI interface and provide some way to access data changed by controller. Since Java can do so much your controller could share the data via http interface using Java HTTP Server
Batch can read data from url in many ways. Like something standard or any program like wget or curl.