vscode-java: Could not create parent directory for lock file

After upgrading visual code and this extension I’m seeing the following error when opening my gradle projects and trying to run it.

[Error - 11:07:49] 29/01/2019 11:07:49 Error occured while building workspace. Details: 
message: Could not install Gradle distribution from 'https://services.gradle.org/distributions/gradle-4.10-bin.zip'.
Could not create parent directory for lock file /usr/share/java/gradle/wrapper/dists/gradle-4.10-bin/bg6py687nqv2mbe6e1hdtk57h/gradle-4.10-bin.zip.lck;code: 0
Environment
  • Operating System: Antergos Linux 4.20.4-arch1-1-ARCH

  • JDK version: openjdk version ā€œ1.8.0_202ā€

  • Visual Studio Code version: 1.30.2

  • Java extension version: 0.37.0

Steps To Reproduce
  1. Open a gradle project
  2. Try to run it
Current Result
Expected Result
Additional Informations

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 26 (8 by maintainers)

Most upvoted comments

@franciscocpg could you try the following:

cd <your_project>
export GRADLE_USER_HOME=~/.gradle
code .

``

On Linux I faced this issue when I tried to open a project that was built with an old SDK, I was able to solve this issue by making my bin folder writable in the user directory. You can try following these steps: Step 1: Open the terminal as root Step 2: Write the following command: sudo chmod 777 /usr/bin/ Step 3: Enter Step 4: Now try again to update your build.gradle file in the app level.

cd <your_project>
./gradlew build