vscode-java-debug icon indicating copy to clipboard operation
vscode-java-debug copied to clipboard

VSCode and folders in repository from GitHub

Open espenj90 opened this issue 5 years ago • 8 comments

First of all I'm not an expert, but I will try to explain my issue as well as I can. I'm not sure if it's a bug, but I still need help to figure it out. I was working with a GitHub-repository with standalone .java-files (no Java-project, Maven etc.). I'm a student, and so far we are programming Java by making different classes in different .java-files, that works together by being in the same folder. Then I changed the name of the repository, and added some folders within the repository and moved my .java-files into one of those folders. Then I tried to run the my program, by hitting "run" on in the file that contain my "static void main-method". It then returned a "fileNotFoundException", because the program I coded was trying to read from a .txt-file inside the folder. The program had worked before I renamed the repository and moved the files into the folder. After some googling, I found out that the issue was that I moved the .txt file, and that this could be fixed by deleting the directory "Library/Application Support/Code/User/workspaceStorage". So I did, and it didn't fix the problem, and created another problem, which is now the problem that I need help with. When I open my GitHub-repository (which I have cloned to my Mac) in VSCode it opens fine, and I can open the folders inside the repository in the file-explorer in VSCode. But when I open one of the .java-files within one of those folders, it seems like VSCode sets this folder to a main folder or something, because when I go into one of those other folders inside the repository, and open one of the .java files there, then VSCode says that "filename.java is not on the classpath of project nameOfProject, only syntax errors are reported". But I have not created a project or anything, I just have .java-files inside the same folder, and they work together that way. So how do I fix this issue, because I didn't have a problem with this before, and it reported all sort of errors, not only syntax error

Environment
  • Operating System: MacOS 10.15.4
  • JDK version: 1.8.0_231
  • Visual Studio Code version: 1.43.2
  • Java extension version: 0.8.1
  • Java Debugger extension version: 0.25.1
Steps To Reproduce
  1. Open my GitHub-repository that has been cloned to my computer.
  2. Open a .java-file within a subfolder in the repository.
  3. Open a .java-file inside another of the subfolders in the repository.
  4. Try to run a file with static void main-method in it.

[attach a sample project reproducing the error] [attach logs] I try to add a logg here, hope this is the correct one

Current Result
Expected Result
Additional Informations

espenj90 avatar Mar 30 '20 09:03 espenj90