How to Create a Java Project for Visual Studio Code - java

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?

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

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.

Related

Visual Studio Code not automatically create bin folder, file .classpath and file .settings for java language

I have some problem in visual studio code :
Visual studio code for java not create folder bin, file .classpath, .project and .settings automatically.
Sreenshoot :
In explorer VSC
File app.java and app.class in the same folder (src), when I look tutorials in youtube, file .class should be in bin folder.
In settings.json there is file.exclude, when I change .classpath to the false or delete it. It always reset to the true again. But if I run my code. it works.
Screenshoot : settings.json file (user)
Can someone help? I've search in any forum but never found solution and make sure path in my environment is correct!
Windows 10, VSC 1.53.0, jdk 15 (latest)
Edited
I ask this question when I'm very new with Java, now I understand, some file like .classpath, .project and etc will show when I use build tools like gradle or maven. Maybe because tutorial on youtube use old vscode version and not explain more about this file, actually this is like dumb question. But maybe this can help someone that new in Java too
If your project is newly created in VS Code through the command Java: Create Java Project.... This command will create a new project without build tools. (No Maven and Gradle). In that case, the files such as .classpath, .project, etc... will be hidden in the workspace storage path, which is by design, since we want the user just focus on the code itself.
If you want to see the bin folder, there is a setting called java.project.outputPath, you can set a relative path to that setting, then the output folder will be explicitly show in your project. For example: "java.project.outputPath": "bin"
Note, the setting java.project.outputPath only takes effect in the workspace scope.
I'm not interested at the youtube tutorials, but the folder structure in vscode-java is indeed like what you see.
In integrated Terminal, there'll a series of execution scripts shown before the real output. The one ends of folder bin is also the current project's classpath. The .class files which is generated by being compiled are stored there.
Setting.json is stored under the folder .vscode. This is your workspace setting, which is generated by pressing Ctrl+, and choosing workspace.

android studio not generating iml file?

hi i am android developer and i am getting some problem , usually i do not care about .iml file in project folder but my senior said me that i do not have .iml file in my project . i do not know what the usage of .iml file and how to use it .
but the main thing is that android studio is not generating .iml file for my any project . for example in other developers project , if project name is apple than there would be apple.iml in project folder but it is not happening in my case . i have also updated my Android Studio in hope that it would get fix but it didn't .
well , please help me how to fix this problem and also tell me what is the usage of .iml file in android projects
IML is a module file created by IntelliJ IDEA, an IDE used to develop Java applications. It stores information about a development module, which may be a Java, Plugin, Android, or Maven component; saves the module paths, dependencies, and other settings.
In case if an .iml file is not generated on your project, there
are two ways to do that,
First:
Go to Android Studio and open your project.
Go to Files
Select Sync Project with Gradle Files
Second:
Close your Android Studio
Go to your root project directory
Delete the .idea folder. If not visible you can check the hidden folders
Import the same project again.
This should re-generate your .iml files
To generate a new .iml file
You have to delete all the folder starting with the dot(.) like .idea, .dart_tool and pubspec.lock file
The project folder name should be all lowercase, with underscores to separate words, just_like_this.
Open your project in the Android Studio from terminal run this command flutter create --platforms=android .
This will generate just_like_this.iml file for you. If your package name is different then delete a new directory generated in your project file if needed.

Full java code from Netbeans Project

How can I get the full java code of a netbeans project? I have created a project for a contest, but need to submit the whole code. In Netbeans alot of the libraries and classes code is hidden. I need to submit all this. Even if a plugin needs to be installed.
Thank You :)
Assuming you have a NetBeans Project named HelloWorld in your system,let's assume that the default directory of storage of NetBeans Projects is in
C:\Users\USERNAME\Documents\NetBeansProjects\HelloWorld // On Windows OS
/home/NetBeansProjects/HelloWorld // On *nix(Linux,Unix) based OS
If it is different from the above,then please switch to the default directory of the Netbeans Projects.
Select your project folder from that,HelloWorld here.
It'll have several directories(folders) inside.
Switch over to src folder. All the .java files are placed in that directory. Those are the source code in Java. You can open and check and verify those files using any text-editor like Notepad,Gedit,etc.
NOTE :- DON'T DELETE ANY OTHER FOLDER/FILES unnecessarily,else,your NetBeans project won't be recognised/won't run properly.

Issues getting files from my friend to work on my eclipse?

My friend sent me a project from his eclipse workspace for me to take a look at, however when I tried to put the folder in my workspace it did nothing. I opened eclipse and nothing was there. So i tried to make my own project and just put the .java and .class files in their respected folders, but it still didn't work. Is there some special way I have to transfer them? I should also mention he has a windows computer and I have a mac if that makes any difference for file types like that. Thanks for the help!
If you can just take the .java files and paste them into your 'src' folder in a new eclipse project, you should have no issues. Just make sure you refresh your project in eclipse(right-click on project folder and click refresh, or click on it and hit f5).
This is what i normally do.
Suppose your eclipse workspace is D:\EclipseWorkspace and your project name is Project1.
Then i would copy Project1 in eclipse workspace on disk to have D:\EclipseWorkspace\Project1.
Then create a new java project in eclipse and when prompted for name provide name as Project1 (exactly same) and say finish. It will import the project automatically. Everything should be up :)

Missing CDT builder / how to tell eclipse that a project includes some C++

I have a fully working pure java project and a fully working Java & C++ sample project in the same workspace. I decided to copy some of the C++ elements from the sample project and get them working in my previously java only project.
Eclipse seemed to know about how to handle the C++ parts in the sample project. Indeed I could delete the .so file in the libs/armeabi-v7a and then ask eclipse to rebuild the project and hey-presto a new .so file would appear and the program could then run again. Unfortunately the same could not be said of my original project. Eclipse seemed not to know what to do with the files in /jni, i.e. clicking on build project would not create an .so file (though I could create the so file from a DOS command line by typing ndk-build). Looking at the properties of the two projects I noticed that in the sample project, under "builders", it listed (amongst other things) a "CDT Builder" whereas in my original project it was not listed. I assume that this is the cause of the problem, but I can not work out how to get CDT Builder listed in my original project's properties.
Solved: Highlight project name in eclipse, then right-click and select android tools > Add native support. Then add a dummie name for a library and click finish. This dummie name will appear with a cpp extension in the project's /jni directory. The CDT builder is now associated with the project. You can then delete the dummie file if you don't plan to use it.

Categories

Resources