Read-only files
If a file is read-only, it is marked with the closed lock icon in the status bar. If a file is writable, it is marked with the open lock icon .
Toggle the read-only mode on and off

- Open a file in the editor and click the lock icon / in the status bar.
- Alternatively, select a file in the Project tool window ( Alt+1 ), go to File | File Properties in the main menu and click Make file read-only .
If a read-only status is set by a version control system, it is suggested that you use IntelliJ IDEA version control integration features. For more information, refer to Version control.
Last modified: 09 November 2023
Handle modified without checkout files
If you are going to modify or delete a file under Perforce version control, the read-only status of such file should be removed. IntelliJ IDEA takes care of automatically making files writable. However, you can change read-only status manually, which may happen in a number of ways; for example:
- With the Clear Read-Only Status option enabled, you make a file writable using a file system.
- When a read-only file is opened in the editor, you double-click lock icon in the status bar.
- You remove read-only attribute externally, using file properties.
In these cases, the file gets status Modified without checkout and appears in the Changes view.
To resolve ‘modified without checkout’ files
- In the Changes view, expand Modified without Checkout node, and select the desired file.
- From the context menu of the file, choose Check Out . The file becomes writable, and moves to the active changelist.
How to Change Read-Only Status of Files in intellij

I have a Java project and I want to modify it in intellij but I can’t do it because of this » read-only file « or «file is not writable» , so how I can modify and execute it?
5,777 72 72 gold badges 59 59 silver badges 130 130 bronze badges
asked May 30, 2017 at 14:58
Harry Prn Dz Harry Prn Dz
761 1 1 gold badge 5 5 silver badges 3 3 bronze badges
I also googled it; google also links to SO.
Jul 29, 2017 at 0:35
@ayip I just did, and google pulled this up as the first search results to lead me here.
Apr 22, 2021 at 0:43
Just a cent: For one reason or another, when opening a project something bad happened inside of IntelliJ (with an error pop-up) and it marked the project as read-only. After removing the .idea-folder and reopening the project all was fine.
Sep 15, 2021 at 10:10
May 10, 2023 at 22:57
9 Answers 9
To toggle read-only attribute of a file, open file in the editor, or select it in the Project tool window. Do one of the following:
- On the main menu, choose File | File Properties | Make File Read-Only , or Make File Writable .

- Click the lock icon in the Status bar in the bottom right corner.

10.4k 3 3 gold badges 56 56 silver badges 76 76 bronze badges
answered May 30, 2017 at 15:03
Carlos Bernardes Carlos Bernardes
491 4 4 silver badges 10 10 bronze badges
A screenshot for this answer would be great
Sep 16, 2020 at 20:23
I added a screenshot and updated the text for current release (2002.2.3)
Oct 9, 2020 at 9:14
If IntelliJ IDEA is unable to change the file permissions using File | File Properties | Make File Writable, then perhaps another user is owning that file, e.g. root (use this command to verify: ls -hal /path/to/File.java )
If someone else owns it, for whatever reason, you can change the permissions yourself using the chown command in the terminal:
sudo chown yourusername /path/to/File.java ,
where yourusername is the same user that you used to launch Intellij IDEA.
answered Feb 5, 2018 at 13:53
Håvard Geithus Håvard Geithus
5,554 7 7 gold badges 36 36 silver badges 51 51 bronze badges
Worked for me by chmod 0777 /path-to-file . Thanks
May 11, 2020 at 16:06
How to do this for Windows?
May 3, 2022 at 13:03
For Mac, this definitely works:
sudo chmod -R 777 /YourDirectory
answered Dec 9, 2019 at 14:35
Dato Gogshelidze Dato Gogshelidze
696 8 8 silver badges 20 20 bronze badges
This reminds me of xkcd.com/1217. OP has an issue with a single file, so while changing all rights of all files under the root directory work, it’s almost always a bad solution. It’s like removing all walls of your house just because you lost the key of one door.
File is read only
Может и тупой вопрос,но я только начинаю изучать Java и писал код через Intelliji idea и все пошел спать.На следующий день открываю и не могу изменить код . Пишет file is read only,что делать подскажите
Комментарии (3)
- популярные
- новые
- старые
Для того, чтобы оставить комментарий Вы должны авторизоваться
Александр Работает в безработный
1 марта 2021, 13:17
Хорошая штука этот замочек , нажал и никто случайно не сможет напортачить в твоём коде. Хочу дать совет , если хочется получить ответ на какой то вопрос , то лучше задавать его в разделе помощь или в чате. Я не знаю новичок ты в программировании или нет , но если джава твой первый язык, то я бы советовал начать писать код сначала например в Notepad++, потому, что Intelliji idea многое делает сама, а в Notepad надо самому думать и делать , а это в свою очередь даёт хороший навык думать и набивает руку. Хотя и Intelliji idea наверно можно где то отключить все авто дополнения , но я не нашёл , где это можно сделать.
RedDuck Android Developer
28 февраля 2021, 17:56
Или замочек внизу справа, или через настройки. Но у меня сначала была проблема, что я создавал не class и не package, a просто java-файл. Тогда нон-вритибл почему-то. Тоже посмотри на это, вдруг замочек не поможет.
Влад Java Developer в Tinkoff
27 февраля 2021, 09:15

В правом нижнем углу есть замочек