2

Whenever I run my Main.java file, class files get generated into my bin folder and to my src folder. I've tried configuring the settings.json file and setting "java.project.outputPath" to "bin". After this, I did Clean Java Language Server Workspace in the Command Palette, but it still didn't work. Id appreciate all and any help. Thank you.

Picture of bin and src

settings.json

3
  • 1
    Is there any other process or IDE running that could cause this? Commented May 12, 2022 at 16:38
  • 1
    I'm not sure what else could be running that could cause this. Commented May 13, 2022 at 0:37
  • 1
    Please edit the question by replacing the image of the code with the code represented as a text and formatted by enclosing it in triple backticks ``` or with by using the button { }. Why should I not upload images of code/data/errors when asking a question? Commented May 13, 2022 at 1:14

1 Answer 1

1

This is specified by the Java language. When you run java files, class files will be automatically generated in the current directory.

`"java.project.outputPath": "bin"`  
and
"java.project.sourcePaths": [
    "src"
],

in your setting.json means when you use this workspace, the java file in the source paths will be compiled into a class file for you and stored in the output paths.

You could try to delete all .class files and reopen the project. You will find that all class files will be loaded automatically in the bin directory.

Sign up to request clarification or add additional context in comments.

2 Comments

I tried deleting all of the class files in src and bin and I reopened the project, and it still didn't work. I then tried just deleting the class files in src, and then just bin, but that didnt work either
@mexicanburrito Are you using the tool architecture to build the project? I suggest you using tool to creat project. code.visualstudio.com/docs/java/java-project If this still doesn't work, you can submit it as a bug to github.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.