Vscode-java: Renaming file causes FileNotFoundException on java language server start

Created on 14 Feb 2017  ·  7Comments  ·  Source: redhat-developer/vscode-java

##[provide a description of the issue]

Environment
  • Operating System: 10.12.2
  • JDK version: jdk1.8.0_121
  • Visual Studio Code version: 1.9.1
  • Java extension version: 0.0.10
Steps To Reproduce
  1. Rename a file and folder of package
    In my case it was
    android/app/src/main/java/za/co/io/reactnativekeystore/KeystoreModule.java android/app/src/main/java/za/co/io/reactnativekeystore/KeystorePackage.java
    and I renamed them to
    android/app/src/main/java/za/co/io/reactnativecrypto/CryptoModule.java android/app/src/main/java/za/co/io/reactnativecrypto/CryptoPackage.java
  2. Restart VSCode
  3. Language server fails to start throwing FileNotFoundException

Purging ~/Library/Application Support/Code/User/workspaceStorage and restarting VSCode solved the problem

bug need info

Most helpful comment

Try the following steps:

  • close VS code
  • delete %APPDATA%\Code\User\workspaceStorage\.
  • restart

All 7 comments

I can't reproduce this issue. Could you please paste a complete stacktrace?

I have the same issue: I created a folder src and moved all my files inside, but the extension keeps looking for the file at the project root whenever i close/reopen vscode.

File not found: C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\Main.java.

(Path is now C:\cygwin64\home\Kyasaki\etna2\tic\djav\proj\ src \Main.java.

Try the following steps:

  • close VS code
  • delete %APPDATA%\Code\User\workspaceStorage\.
  • restart

Deleting the workspaceStorage greatly works for me 👍
Doing it manually therefore is a little bit ugly :/

The problem still exists—"file not found" errors in console for renamed/removed files—and is still fixable the same way, workspaceStorage: del /s /q %APPDATA%\Code\User\workspaceStorage\ with closed VS code

Operating System: Win 10 Enterprise 14393.1358
JDK version: jdk1.8.0_121
Visual Studio Code version: 1.13.1
Java extension version: 0.6.0

I'm going to say that I still have this same issue, solved by the manual deletion of workspaceStorage.
Looks like it just doesn't make a simple check whether the file exists or not, and errors out when it tries to load it.

Operating System: Win 10 Pro 15063.674
JDK version: 1.8.0_144
VScode: 1.17.1
Java extension version: 0.11.0

Same issue here [REDACTED] when I tried to move/rename a folder/file.
As it's impossible for VS Code to support Alias feature of macOS that tracks the path of any file, it must use symbolic link which broke when any folder in the path is renamed, so I removed the folder from the workspace and readied it after renaming.
However, what I don't realize is that the Java Language Server still sticks to the path to the file even after it's removed from the workspace! I tried restarting VS Code and even Reinstalling the whole extension pack but neither of them helped — the error persists. Thanks you for your fix 🙂 as I cannot find it anywhere else.
It must be a problem that it is saving caches to the disk folder "workspaceStorage" which contains the path to the source files
[REDACTED]
I think VS Code should add a move/rename folder/file feature

Operating System: macOS High Sierra 10.13.2
JDK version: JDK9
VSCode: 1.19.1
Java extension version: 0.16.0

Error log when I tried to move the folder "Java Test" from ~/No Sync/Java Testing/Java Test to ~/Desktop/Java Test:
VS Code Java Extension By Red Hat Error log.txt

Note: I edited this comment and removed unnecessary information and added logs

Was this page helpful?
0 / 5 - 0 ratings

Related issues

protoEvangelion picture protoEvangelion  ·  3Comments

ronniehicks picture ronniehicks  ·  3Comments

joewood picture joewood  ·  3Comments

gorkem picture gorkem  ·  4Comments

ViniciusAtaide picture ViniciusAtaide  ·  4Comments