0

I've written a medium-sized Java program for an exporting company. I want to limit the employees' ability to edit some files (such as a Sales Contract Log) to only the Java application's user interface. If I change the file permissions, then I assume the Java application cannot edit the files either (as the application would be run from the current user).

As one specific example, how can I allow the Java program to alter information on a log text file without allowing the user to simply open the text file and edit it however they want?

2
  • I think you could encrypt the files (make a separate small java program for that). Them, you decrypt them with your java program you already have, edit them, and then encrypt them again. Commented May 23, 2018 at 16:49
  • @actunderdc: But the user can grab the decryption key from the Java program. Commented May 23, 2018 at 17:28

1 Answer 1

0

I think you can run the jar as another user. In this way users are logged with their user, but program run as different one. Then you have to change permission of file.

Check this link to see how to run the jar as different user launch .jar as a different user . In this link the example is with admin, but you can apply to a different user.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.