0

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?

1
  • 3
    Modify the batch to take a parameter like shown here stackoverflow.com/questions/26551/… simply launch the batch like "file.bat variablehere" Commented Jun 12, 2015 at 17:07

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.