0

I am writing a Java code where i have the user id with me which will be needed in the EXE file. So for this I am thinking of appending the user id at the end of the EXE file. The code i have written is as

public void appendUser()
 throws Exception {
 Files.copy("/tmp/generic/myFile.exe", "/tmp/myFile.exe");
 BufferedWriter fileWriter = new BufferedWriter(
 new FileWriter(destination.getFileName().toString()));
 fileWriter.append("MrX@google.com");
 file = new File(destination.getFileName().toString());
 }

But this will modify the generic copy of the EXE.

I can copy the file at the temp location first and then append the userId on that file and return it. But i want to know if there is any other smart way where i dont have the create the separate copy of the file first .

1 Answers1

0

If you can pass the parameters to the executable file instead you could start it directly from the location without copying.
Java Programming: call an exe from Java and passing parameters
But I dont knwo if that's possible for your problem...

benebo22
  • 241
  • 2
  • 5