简体   繁体   中英

Inno Setup Compiler - JavaFX app doesn't write files

I have written a simple JavaFx app that visits a series of urls using PhantomJS and saves screenshots to a folder in the same directory. For example if the jar/exe is located in the folder "my-app", it will save the screenshots to "my-app/screenshots" just fine. However, after using Inno Setup Compiler to create an installer, installing the app on my own computer, and then running the version created by the installer, it fails to save anything. What could the issue be? This is an example of what my code looks like when creating/saving an image:

byte[] bytes = phantomDriver.getScreenshotAs(OutputType.BYTES);
File outputFile = new File(outputFolder, String.format("/Home Page/Home_Page-%s.jpg", timestamp));
outputFile.getParentFile().mkdirs();
FileUtils.writeByteArrayToFile(outputFile, bytes);

Thanks for any help in advance

Applications typically install to Program Files files. You cannot write files there (unless the application runs with elevated privileges, what is not recommended).

You should modify the application to write files to a user profile or to a configurable location.

If the application writes to the current working directory, as a quick hack, you can modify the shortcuts, created by the installer, to set the working directory to user profile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM