Can't open my Java project in NetBeans - java

I am working with JDA+NetBeans. Suddenly my project refuses to open. I get the error
Invalid byte 1 of 1-byte UTF-8 sequence.
How can I fix it?

I suggest to look for UTF-8 characters (such as umlauts etc.) and delete/replace them; you could also try to open the file with another editor, save it and try Netbeans again.

open your files in notepad++ choose
Format -> convert To UTF-8

If the project get not opened, one of the project configuration files in the nbproject folder are corrupt. You can do:
Create a new project and copy the sources to the new project (and all the other things you did in the old project)
Open the corrupt project thru the Favorites window. Have a look into the nbproject files, maybe save again the files when opened from the Favorites window.

Related

File Saving Under Wrong IDE

I have been using two separate IDE's for my coursework (jGRASP and Netbeans). Whenever I attempt to save a file in Netbeans, the file automatically saves as a "jGRASP Java file" instead (see picture below). When I open the project from file explorer it automatically opens jGRASP instead of Netbeans, even though I saved the project while using Netbeans. Is there a way to ensure that projects I work on in Netbeans do not save as jGRASP files? When submitting my assignments, I have been instructed to ensure they are Netbeans projects (not any other IDE).
What it looks like to me, is the file association for .java files in your computer are set to use jGRASP, you should be able to just change the association in your PC and it would be fine. They are just .java files so if you submit them it should be ok, but you can change it.
https://support.microsoft.com/en-us/windows/change-default-programs-in-windows-10-e5d82cad-17d1-c53b-3505-f10a32e1894d
To explain a bit more, there is nothing in the file itself that indicates which application saved it. A source file is just plain text, and what you see when editing it is all that is there.

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

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.

opening of eclipse files written to java

I want to open a file in eclipse but I get this error
my friends i want to open the eclipse file that i write from befroe on other pc but it does not open and tell me this error;
It looks like you are trying to open a .class file which is not in the current workspace. The class file editor does not support this and gives this error when you do this.
Note: The class file editor does not attempt to convert the contents to Java, it just shows you the Java bytecode.
I guess the file is visible in eclipse but it is impossible for you to open it. Try to Project -> clean workspace.

Chinese characters in gitignore

I am using git for bunch of my java projects. I want to ignore .classpath, bin, .gradle and bunch of other files and folders.
I cannot access this files / folders in eclipse to ignore them from eclipse. Hence I decided to edit the .gitignore file. The file contains random chinese characters.
I still went ahead and updated the .gitignore file with the required file list. However, when I ignore any other file from eclipse, the .gitignore is again appended with chinese characters.
Is this expected behavior? How do I add files like .classpath, bin and others to gitignore?
I fixed this issue. It was an encoding issue. The .gitignore file was created by someone else. I don't know what editor / platform was used to create the file.
I am using eclipse on windows. I had tried opening the file in eclipse editor / notepad / notepad++. All I could see is chinese characters. Even if I added a new file to .gitignore from eclipse (Rt Click --> Team --> Ignore), the file was appended with more chinese characters.
I changed the encoding of the file from "Default" to US-ASCII / Cp1252. I am seeing the expected data now. I can edit this file in notepad and adding new files from eclipse also gives expected results.
UPDATE:
To view .classpath, bin, build, .gradle and other such files and folders in eclipse package explorer, click on the small arrow in the top right of the package explorer. Select "Filters" from the drop-down menu. Select / deselect the filters.
AFAIK .gitignore opened in the simpliest notepad shouldn't have any "chinese characters", should be plain text. Maybe you have a different font set up in your notepad or something?
Here you can see some examples of how it should look How do I ignore files in a directory in Git?

When trying to open a .java file from windows explorer I get a "No project found to open file in" error message

So, when I double click a file in windows explorer, Intellij fires up, but instead of just showing me the file I want to see, shows up the following message:
I think I get what it means: it means this given .java file isn't associated with an Intellij project.
That's actually true, but even so I'd like to be able to open the file and see it with syntax highlighting and such.
How to overcome this problem?
Thanks
It's a known limitation which we plan to address in the future versions to allow opening and editing individual files without project context.
Please watch/vote the related issue.
I don't think you can'tcan by default. I'm assuming you are opening downloaded files or such. What I would is create a project (Scrapbook for example is a good name) on desktop and I would put/download the file I want to see in the corresponding src folder. That way when I'm clicking it would open properly.
Most of the syntax highlight and such goodness of idea comes from a proper project setup (proper JDK paths, libraries, etc).

Categories

Resources