6

I have just transitioned into Visual Studio Code from Eclipse for Java. I want to create a simple HelloWorld folder which has src and bin folders. However, I do not know how to create the .classpath, .project, and .settings the same way Eclipse does it. How do I do this?

9
  • Visual Studio Code does not (and will not) use eclipse .classpath, project and .settings files. Why would you assume that it does? Commented May 12, 2018 at 5:12
  • Hello it says: Maven, Eclipse and Gradle Java project are supported through Language Support for Java(TM) by Red Hat, by utilizing M2Eclipse which provides Maven support and Buildship which provides Gradle support through the Eclipse JDT Language Server. code.visualstudio.com/docs/languages/java Regardless, how would I create a brand new Java Project with src and bin in Eclipse. I want to practice all the problems in LeetCode. Commented May 12, 2018 at 5:19
  • And here RedHat says "Recognizes projects with maven or gradle build files in the directory hierarchy." - the m2eclipse project provides maven support to eclipse; it's a plugin. It provides maven support to VS Code. Since you don't want to use maven, I can only suggest you want something else. Commented May 12, 2018 at 5:23
  • Alright, lol. I just wanted a simple way to write code haha. How would I even go about Maven or Gradle then? I just want to build, run, debug code. Is this possible? Commented May 12, 2018 at 5:32
  • Super simple way to write code: Download Netbeans and use it. Commented May 12, 2018 at 5:33

3 Answers 3

9

Hit Ctrl+Shift+P to show all commands, then type "Java" and select "Java: Create Java Project"

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

1 Comment

For some reason I don't have this command in my VS Code. Can you help with troubleshooting?
1

Visual Studio Code doesn´t have this orientation of creating a project because it´s file oriented. It´s on of the diferences with Visual Studio.

It means that creating a project structure is based on folders and files, and no file references and links the folders and files to a project. If you want to create a project with src and bin folders, you´ve to do it manually.

Comments

0

First you need install some packages for Visual Studio Code. You can find all in this Microsoft Support page: https://code.visualstudio.com/docs/java/java-tutorial

After you have installing it, you can press CTRL+SHIFT+P and type Java for get all commands.

In your case, for make a new project, follow these tips:

  1. Press keys: CTRL+SHIFT+P to open Command menu
  2. Type: Java: Create Java Project
  3. Select a project type, like No build tools
  4. Select the project location
  5. Type the project name, like: My first program
  6. If appear the alert window, trust the authors of the files in this folder by pressing the button Yes, I trust the authors

Now your project is created. You can see the folder src with the file App.java and the Hello World's code inside.

Now for testing your first program, press the right mouse button on App.java file and select Run Java

menu from visual studio code

Now, if all works, your Hello World's program is printed on your Terminal window. output in terminal window

Comments

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.