Deleted files magically re-appear in VS Code Maven Java project - java

Quite simply, I have some files I need to delete from my Java Maven project in Visual Studio Code. I can delete them either from VS Code or the file system (windows 10), but they later re-appear back in the project and filesystem.
I currently don't have any kind of source control associated with the project. I'm new to coding with Java and Maven in VS Code, not new to VS Code generally and I've never had this happen in any of my .Net, Ruby on Rails or Javascript projects.
All of the files in question are xml files. In one case, I accidentally created the file using a filename without a dot before the file extension and after correcting by renaming, the mis-spelled file came back! - See hillClimber2SolverConfigxml in the image below.

I had the same problem. When using global search VS Code would always find something in deleted files. What I did is reopened my project:
Menu -> File -> Close Folder
and then
Menu -> File -> Open Folder
Now I don't have the search problem.

Related

Java Project for vscode doesn't works fine

Whenever I create a new maven project in vscode, the Java Project extension doesn't update as the file explorer does, so I have to manually clean the workspace caches to make it synchronized. Also, the only file category I could add in Java Project view is the .class files, so I have to quire with the explorer. In some cases, suppose I need to add the same file in two or more nested folder like src and target, which is confusing, it' s never the case in eclipse and other refined editors for java, is there a way to solve these two problems?
I will publish my operation steps in the answer. You can also refer to the official documents for more information on project management
Creat java project
Creat a new floder to save Maven
Vscode automatically generates Maven project and workspace environment
There is no need to empty the workspace. Of course, if you want to create a project in the original directory, it may cause similar problems.
For your second question, I think java project only manages Java classes. If you want to put other file types, why not use file explorer.
Java project has its own things to do

IntelliJ IDEA one project - two operating systems

So I am creating a java project with a friend of mine, he is using windows and I am using ubuntu. I didn't give it much thought because java is cross-platform but I am having trouble opening the project I cloned from our git repo that he created in windows. The file browser recognizes the project but when I open the folder with the intelliJ icon it only opens the iml file and the class files, but not the folders and I don't have a hierarchy on the left tab. So I am wondering if it is a problem with our OS or if its some problem with intelliJ.
How did you set the project up with Git? You should only be pushing your source files, and all others (such as the .iml) should be ignored. That way, any person using any OS or any IDE can easily set it up on their own.
Try removing all your files from git besides the source files. Now, if you clone it and set it up with IntelliJ, any IntelliJ specific files should stay locally, and only source files will be pushed.

how do i compile and run simple java files on eclipse from a src folder?

I am in an intro cs course learning Java and the prof gives us unfinished files to complete for our projects. The last projects have been simple and Ive been able to just open eclipse, start a new project, and create a new class with a the same name and just copy and paste the plain text from the files he gives us. However this time that approach isnt working. Basically I have the folder called "src" and i need to know exactly how I can open it in eclipse and start working on the project and be able to run it. Please help me.
basically i downloaded "Project3" from my prof's website. I unzipped it and it conatined project3.pdf - the project outline, and the folder named "src"
inside the src folder are Project3.java and sample3.java that are both used together in the project. All i need to know how to do is to be able to open them in eclipse and start working on it. If i copy and paste the plain text fro the java files to a new project in eclipse i get all kinds of errors.
First of all, you can just copy-paste the files into eclipse.
Second, you can use File -> Import -> General -> File System to import files from the file system into eclipse after creating a new Java project.

Importing an API (UniprotJAPI) into Eclipse

I downloaded an API from Uniprot, which is a protein database, to play around with their code. This is my first time working with an API. The API contains a folder of source files (which includes example code for developers), a folder for classes, a library of JAR files, and an executable command file to run the example code (in cmd, I must execute: runExample.cmd InsertExampleCodeHere )
How do you edit this API? I tried making my own Java project, linked it to the JARS I downloaded, and also transferred over the executable cmd program to my Java project folder. At first, I copied over some of the example code, and added some print statements. When I saved my changes and executed the cmd file, my main class cannot be found. If I tried compiling my java project, I get a bunch of errors - and these errors apply to the example codes Uniprot provides (and while linked to the library of JARs). Is there a particular call (or special command) I must make when compiling my projects?
Thanks in advance!
Hmm, not sure myself as the only real API I was using was a JSON one so I could easily parse it. But, assuming you have a folder that contains of all that, I would imagine you could try to just copy it over to your project's folder and then just add it to build path in a similar vein to how you would add jars. At least that's what I can think of.
Also, you could try this which is a solution I found from the Stackoverflow question titled "How do I important the javax.servlet AOI in my Eclipse project?"
Quick Fix- This worked in Eclipse - Right Click on project -> Properties -> Java Build Path (Tab) -> Add External JARs -> locate the servlet api jar implementation (if Tomcat - its named servlet-api.jar) -> click OK. That's it !!

How do I get eclipse to compile and copy only .java files during build?

I have a dynamic web project in eclipse (although I'm not using it as a web project. I would like to convert it to a java project if possible) and there are java files all over the place. There are also a lot of other files like images etc (which I don't want to remove because the project is linked to my SVN repo so if i do an update then everything will come back).
Now when i build my project eclipse copies all the files instead of compiling and copying the .java files only and this takes a lot of time because there are some 2GB worth of files.
I tried to include only .java files in the source by going to properties of my project -> Java Build Path -> source tab -> includes -> I added "*.java" to the textbox. However, no file got copied to my output folder after that.
how do i go about this? Deleting the images etc from my project is not a solution here.
Add **/*.java/ in the includes.

Categories

Resources