Linux permissions in Java


I wrote it because I had to code permission changes in Java with my software.

Change the file permissions written on each line of permission.list.


    static ArrayList<String> permpaths;

    public static void readPermissionList(){
        permpaths = new ArrayList<>();
        Path p = Paths.get("permission.list");
            try {
            FileReader fileReader = new FileReader(p.toFile());
            BufferedReader bufferedReader = new BufferedReader(fileReader);
            String data;
            while ((data = bufferedReader.readLine()) != null) {
            } catch (IOException e) {


    public static void setPermission(){
        for(String filepath :permpaths) {
            try {
            } catch (IOException e) {


Recommended literature

Recommended Posts

Linux permissions in Java
Linux permissions
Facade pattern in Java
Singleton pattern in Java
Flyweight pattern in Java
Observer pattern in Java
Use DataFrame in Java
Linux permissions [under investigation]
Iterator pattern in Java
Meaning of Linux permissions
Decorator pattern in Java
Seurat in Linux (installation)
Prototype pattern in Java
Proxy pattern in Java
SSH restrictions in Linux environment
Linux file and directory permissions
Template Method pattern in Java
Linux: DNS replacement in systemd.
Run Amazon Linux 2 in VirtualBox
Meaning of Linux directory permissions
Implement Table Driven Test in Java
Detect and process signals in Java.
Install oracle java8 on amazon linux2
Handle dates in Linux bash commands
Install tensorflow in Docker (LINUX) (memo)
Put only kubectl in Amazon Linux 2
Chain of Responsibility pattern in Java
[Linux] [kernel module] Create kthread in kernel module
Implemented bubble sort in Java (BubbleSort)
Remote debugging in Visual Studio (Linux)
Linux command (basic in basic) personal memo
Change font size in Serene Linux
Overlapping regular expressions in Python and Java
[Understanding in 3 minutes] The beginning of Linux
Find files like find on linux in Python
[Linux] List of Linux commands used in practice
Express Python yield in JavaScript or Java
Apply Google Java Style formatter in IntelliJ
[Bash / linux] Notes in case of trouble
Differences in syntax between Python and Java
Windows → linux Tips for bringing in data
Get mail using Gmail API in Java
Settings when adding an HDD in Linux
I put Linux (Ubuntu) in VAIO SX14.
Install rJava on Linux in R3.6 environment.
Let's run a Bash script in Java
Communicate with I2C devices in Linux C