Netbeans fails to build because the .jar file cannot be deleted - java

Netbeans fails to build because .jar file from the previous build cannot be deleted. I am unable to delete the file manually or change/view its owners either even with Administrative Privileges. Is netbeans locking these files?

I think I just had this problem. Netbeans isn't the real issue here. The problem is that Java SE is getting stuck for some odd reason. Windows has this problem with apps hanging in the background in general but it also could be the program not exiting correctly due to code.
Here's how I fixed it:
1) Closed NetBeans (may not actually be necessary though)
2) Opened task manager
3) Manually ended Netbeans processes if it's still hanging (again, may not be necessary)
4) Look for any process with "Java SE" in the name and end that process
5) Try to build again.
Worked for me.

Related

Sudden weird errors on a project

Today I came to work, happy. But when I opened my Eclipse, I saw that one of my projects has errors.It's weird because it shows that it has errors only in the window bar, and not in the Navigator. I don't have any Java errors, this is a valid project that was fine all the time:
Some of the errors on the error log of Eclipse:
JavaBuilder handling ImageBuilderInternalException while building: SP_Procedure
Cannot connect to VM
File <SomeFile> has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Internal error
When I run an application from this project, I get a warning message but when I proceed, it works fine, but still. It's very disturbing and I'm not sure if it's harmless.
I tried to:
Restart Eclipse
Restart my machine
Clean projects and recompiling them.
Refresh projects
Pray
Nothing helped. What could be the problem? (I'm using Indigo Service Release 2)
The following nuclear option has desperation written all over it. But I have been where the OP has been with the Juno version of Eclipse.
Run a "Synchronize with Repository" and save all of your local updates to a different directory.
Delete the project. (Check the box to delete the contents on disk. Scary step, but that's OK, because you saved it in a different directory in the previous step, right?)
Read in a fresh project from the repository. It builds happily at this point.
Integrate your local updates.
Keep on praying.
Looks that one unused JAR was deleted, but for some reason, I didn't get errors in any file, even in the files that imports this JAR! So what I did was restoring this JAR, delete unused imports and deleted the JAR again.
I've found this error after two days of navigating on this project on each file.. This is weird that Eclipse didn't recognize that1 this is an error, and throw many unrelated errors such as:
Cannot connect to VM
File has been skipped, problem while reading ('Resource is out of sync with the file system')
Unhandled event loop exception
Is this a bug in Eclipse? (All errors and warnings are enabled!)
1 As seen in the image in the question..
A class from the list of imports for the file seems to have moved out or the jar file containing the class is missing.
Expand the imports section and check if you find some classes that are missing but have been imported.
Though it is a pain, sometimes the easiest solution is to back up all your projects (either in a repository or somewhere else on your computer) then uninstall and reinstall eclipse. No it's not fun, but it should reset eclipse so everything works again. The downfall though is that you have to reconfigure eclipse to any special settings you had/reinatall any extra functionality currently installed (eg. android add-on) and reconnect to any repositories you have. While punting isn't fun, it can be effective... I hope you don't have to resort to this though.
I have went through that problem a lot of times, and tried everything you tried. Rebuild, recompile, refresh, remove and add JDK, remove and reinstall Eclipse... nothing worked
The only thing I concluded is that the workspace metadata was corrupted.
What I did (every time it happened) was
Create an empty workspace
Import -> existing projects into worskpace
Mark the "copy projects" (else it will only link them)
Wait for the copy, and start working with the new workspace
If you work with SCM systems (Git, SVN, etc), making a full checkout will do the trick too, but the worskpace import will let you retrieve those changes you didn't get to commit (if any).
It's a little painful if you have somethings already set (like JDK names, servers, etc), but then I realized it was faster than keep searching how to fix the workspace
Regards!
PS : I've been working with Kepler lately, and everything works fine till now
Click Window -> Show View -> Other -> General -> Problems
This view will show you what is wrong.
Did you, by any chance, update your virtual machine outside of Eclipse? I can't help but feel that we're both missing a finer detail here. I just keep seeing "cannot connect to VM" and thinking that it's a major clue.
Have you tried running anything from the terminal? Does it work there?
If so, do you know where your current edition of Java is located? Is Eclipse looking somewhere else?
Is this exclusive to one project? Do you use any additional libraries to the JDK?
Maybe try this for Resource is out of sync with the file system error:
Right click project in Eclipse Package Explorer
Close Project.
Right click project in Eclipse Package Explorer
Open Project.
Other things not mentioned:
project properties > java build path, see if any of those tabs got changed, local file got moved? read/write permissions on some file you are linking to?
project properties > java compiler, see if workplace settings have changed? maybe under errors/warnings, you can systematically set them to 'ignore' until the error goes away to determine what type of error it is?
maybe update some of the eclipse plugins?
I saw something like this happening for a number of reasons. Mainly because of validation in files other Java source code. See if you are validating XML for instance.
Right click your project and chose Properties (Alt+Enter) and Validation to see the related configuration.
As for the danger, I lived with those marks for ages and nothing wrong ever happened.

NetBeans 7.2.1 Running old code

I have been working on a project for school and recently ran into an error. I realized that NetBeans is not updating code for GUI items that I have updated for my project. It doesn't update on the GUI designer nor when I view in designer preview or even when I run my program. The code that is always being ran is from 2 days ago. I opened an old project and this is not an issue. So far i have deleted the Cache, Cleaned the project and I have Auto Compile on save on. I reinstalled NetBeans as well. Any Suggestions?
I know this is a rather old question, but I ran across this thread while trying to solve a similar (the same?) problem and managed to find a solution, so I'll post it here for future reference.
Are you by any chance running Netbeans on a *nix platform? Chances are you transferred your project files from a filesystem that doesn't support Unix-type permissions - I started having the type of issues you're describing after copying my project over from a NTFS partition, which by default assigned read and write permissions only to my user. cd to your project directory and try chmod -R 777 * (rwx permissions for everyone recursively), then re-open Netbeans to see if your problem is solved. (You might then want re-set a less lenient permission mask on some of the files afterwards, but 777 is a quick way to check.)
(CR)EDIT: #RTOSkit's comment on the OP's question put me on the right track.

exception has been caught while processing the refactoring 'Rename package'

This refactoring function in Eclipse for package names used to work for me fine until... today:
This is the first time I am receiving this weird Refactoring error, and I have no idea what to make of it:
An exception has been caught while
processing the refactoring 'Rename
Package'.
Reason: Problems encountered while
moving resources.
Click 'Undo' to undo all successfully
executed changes of the current
refactoring. Click 'Abort' to abort
the current refactoring.
What could possibly explain this sudden "change of heart" and how do I fix it?
Seems from your snapshot that you are running windows 7, maybe vista. If its not a renaming issue, try running eclipse as administrator. It might be permissions-related, but its just a thought.
I see merit behind what Kurru is saying. Windows is not a case-sensitive operating system, meaning that is sees the words Cat and cat as the same thing. When you rename your package, Eclipse creates new directories/folder to put the package in. If you changed the case of your words and not actually rename it, it could throw this error.
Under Windows this is frequently caused by a file or directory being locked. There can be several reasons for this:
A file is open in a viewing program outside of Eclipse. Windows will not allow the open file to be refactored.
A CMD.EXE is active in one of the directories to be refactored. Windows will not allow the directory to be moved or deleted.
A program is running with open files for items in the workspace. Windows will not allow the items to be refactored.
If this is the behaviour of a freshly started Eclipse on a freshly started machine, it is probably not Windows, but a corrupted workspace or Eclipse distribution, and you should unpack a fresh Eclipse and create a new workspace in which you can import (and copy) the existing projects from the old workspace. I don't think this is the problem, though.
If you're just trying to rename a package to the same name, only with a different case, this error is thrown for me. Very annoying when trying to fix package names to the lowercase convention.
Had some success renaming packages to a step folder, then to the target folder...
ie.
APackage -> apackage FAIL
APackage -> APackage2 -> apackage SUCCESS
Got the same error. It turns out that my ClearCase (version control) plugin was inactive. Simply activated the version control plugin, and the problem was solved.
This can be caused if using characters like underscores in your class names (e.g. My_Class.java). The project will build and run fine. But in Eclipse, if you run Android Tools > Rename Application Package, the rename will fail.
Same refactoring problem occurred to me when I was working in the Ubuntu. The cause is the permission limitations. Eclipse cannot re-factor as it does not have permission. After giving root permission, refactoring worked fine for me.
If it is the problem because of case. I have successfully tried a solution.
This will fail
org.xyz.fileName ---rename---> org.xyz.filename
This will pass
org.xyz.fileName ---rename---> org.abc (rename the structure)
org.abc ---rename---> org.xyz.filename
This will work fine!
I just restart the computer and start STS(Spring Tool Suite 4)
and delete the file/class its works for me.
Check if the folder location is open in the Command prompt. If yes, then close it and try again.

NetBeans locks on startup on Ubuntu 64

I made the mistake of installing NetBeans as root:
sudo sh /opt/myDirectory/netbeansInstaller.sh
I installed it, launched it, and created a dummy project just to get familiar with it. Then I closed NetBeans and came back to it later on in the day. When I try to open/run NetBeans as my normal user, it launches with all sorts of error messages complaining about denied permissions.
So I uninstalled NetBeans completely using the uninstaller, and even deleted the project I created with it. I even deleted the installer itself out of my Downloads folder.
I re-installed NetBeans as normal user, and am still getting permissions errors. Now what happens is it launches, generates some error popups, and then freezes completely. I notice that it is still attempting to launch my deleted project by default!
Here is what I think is happening:
I run NetBeans as normal user
NetBeans has cached, somewhere, that my old project (which was created when I was using the old NB install as root) is the project to load at startup
It automatically complains that it can't load the project properly because I'm not root
It can't find my old project (because its deleted) and so it freezes in this "wait state"
Has anybody else ever had this problem? Any way to force NetBeans (perhaps from the terminal) to do a "clean load" where it won't attempt to load any projects? ANy other obvious solutions?
Thanks!
You could try deleting the .netbeans folders in the /root and in your home directory respectively. Netbeans maybe wants to read the /root/.netbeans folder for which it has no permission.

Headless Eclipse Build returns ERRORLEVEL 13

Everything was going well. Nightly builds ran for more than a month with no problems. However, suddenly when invoking the feature builder from Eclipse the execution ends right away with the message.
ERRORLEVEL 13
As far as I know I haven't changed anything, as this computer is normally not touched. (It is only used for the nightly builds).
I've googled around to see what this error means but to no avail. I found a link from IBM that shows a custom bat file that catches this error, but the explanation given is not very useful.
My guess is that this is related to the workspace, somehow, or that the whole eclipse installation is corrupted.
Do you have any idea what this error means and how can it be corrected?
After reading what the error code means thanks to the answer from VonC I understood where to look. The problem was a lot more obscure that it seems.
I looked into the configuration folder for Eclipse (logs are either written there or in the .metadata folder when something goes wrong), and I found a huge log file. Inside the file I found the following error:
application org.eclipse.sdk not found
and the following exception, followed by a plugin name, several times:
java.util.zip.ZipException: Too many open files
Several plugins could not be loaded, causing a cascade of missing dependencies that prevented Eclipse from launching. I searched the web for this exception and found the following bug description from SUN, which says that Java 1.5.0 can not open more than 2,100 zip files.
The problem started a while after I installed the BABEL project translations for Eclipse into the build computer. These are more than 900 fragments, containing translations for many plugins, one for each language. As I installed it on top of an existing eclipse installation, it seemed that it was not a problem to open them.... until I cleared the workspace for the builds. Then Eclipse wouldn't launch anymore. I went over the limit. It didn't help that the first thing I tried to fix the build was, again.... clearing everything.
Because I only use this computer for headless builds, I didn't realize that the problem was in Eclipse itself and I was looking inside the build process. I only realized when I looked into the log file.
After installing Java 1.6.0_11 I was able to launch Eclipse and go on with my build.
It should mean "ant build failed", meaning the headless ant script fails at some point.
You should check if you can catch the log/output generated by this script to analyze this ant session and see at what point the ant script fails.
If it fails right away, it usually is because of:
a change in rights (writing access), or
in environment variable modifications, or
in resource access (path non accessible).
You also have to check if the computer is still in its original windows domain, and if the rights (admin ?) associated with the account running the ant script are still the same.

Categories

Resources