3

After successfully compiling and cleaning and building many times today, suddenly I have this Netbeans 8.0.2 error:

Unable to delete file C:\Users\Dov\Google Drive\NetBeansProjects\
                      WordyHelperton\build\classes\dictionary.dic

Here's my clean and build output:

ant -f "C:\\Users\\Dov\\Google Drive\\NetBeansProjects\\WordyHelperton" -Dnb.internal.action.name=rebuild clean jar
    init:
    deps-clean:
    Updating property file: C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build\built-clean.properties
    Deleting directory C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build
    C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\nbproject\build-impl.xml:1397: 
Unable to delete file C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build\classes\dictionary.dic
    BUILD FAILED (total time: 1 second)

The line where the error occurred in build-impl.xml is delete ... build.dir...:

<target depends="init" name="-do-clean">
    <delete dir="${build.dir}"/>
    <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/>
</target>

And here's what Windows Explorer has to say about it:

enter image description here

Task Manager showed no processes named java... or netbeans... or nb...

Tried to delete: "You need admin privileges". No can do.

How to fix this?

EDIT

Rebooting caused the files with red X to disappear AND THE FOLDER classes, BUT NOW THERE'S A NEW ERROR:

ant -f "C:\\Users\\Dov\\Google Drive\\NetBeansProjects\\WordyHelperton" -Dnb.internal.action.name=rebuild clean jar
init:
deps-clean:
Updating property file: C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build\built-clean.properties
Deleting directory C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build
clean:
init:
deps-jar:
C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\nbproject\build-impl.xml:896: Directory C:\Users\Dov\Google Drive\NetBeansProjects\WordyHelperton\build creation was not successful for an unknown reason
BUILD FAILED (total time: 1 second)

And here's the directory structure:

enter image description here

Here's the line being executed:

<target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps">
    <mkdir dir="${build.dir}"/>

There's no build and no dist folder.

My question remains: How did all this happen in the first place? It cost me an hour and I'd like to know how to prevent it.

DSlomer64
  • 4,234
  • 4
  • 53
  • 88

5 Answers5

1

I had a similar problem. My Java folder is synchronized with Google Drive cloud. According to the above screenshots, you also seem to use a kind of synchronization service. First time, I had to reboot the computer to fix the issue. Second time, I tried to first stop Google Drive. Then I rebooted NetBeans only (not the computer), and it was OK.

Nicolas56
  • 166
  • 2
  • 4
  • Yes, I'm using Google Drive. It's better than nothing. I backup to external hard drive when conscience dictates. I'll keep your workaround in mind. I didn't try that, but it makes sense. Thanks. – DSlomer64 Jun 19 '16 at 18:37
0

Stopping java.exe in task manager works for me. The error says that the .jar is unable to delete because java is executing this jar

  • I didn't get that message. Nothing about java nor any jar it might be executing.. – DSlomer64 Aug 23 '18 at 21:31
  • Sorry. This is that i understand of this error, when this error appears, i put win+r, resmon; and there are 2 apps named "java.exe" then i stopped them, click in clean and build button and presto. – HAIVER NICOLAS AGUILERA GOMEZ Aug 24 '18 at 22:39
  • I'm glad it works for you. I'm only saying that my original question didn't arise from an error message about java.exe. Now maybe I could have easily solved my problem by using TaskManager to stop java.exe and maybe even Android Studio, but I prefer not to go that route unless my app or AS is hung, which it wasn't, in which case I'd rather respond to the messages I see in hopes of maybe correcting not only the current problem(s) but also future ones. – DSlomer64 Aug 26 '18 at 09:33
0

In a different but definitely related matter (about a different Netbeans project), when I tried to Clean and Rebuild, gradle gave the same error as in original post: Unable to delete file C:\Users\...\NetBeansProjects\Search\dist\search.jar.

Exiting and restarting Netbeans did not solve the problem, which is often the case.

It finally occurred to me to go have a look at that .jar file. So, I went to the ...\dist\ folder and found that search.jar was dated 8/19/19, seven weeks ago.

I then realized that this file was the previous working version. The reason I was in Netbeans was that I had used a shortcut to start this "old" Search.jar and found that it needed debugging. Here's part of the GUI:

enter image description here

I eventually saw this in Task Manager:

enter image description here

Note that Netbeans was busy producing a .jar file named search.jar for project Search, while Java Platform Binary was busy executing an old .jar file named search.jar. The problem was now clear: The location of BOTH search.jar files just happened to be C:\Users\...\NetBeansProjects\Search\dist.

Oops.

The exact error message was this:

enter image description here

I hadn't read it closely enough to realize that it was NOT caused by Netbeans "owning" Search.jar; rather the error occurred by my having launched the "working" version by clicking the shortcut to the old .jar file, which caused Java Platform SE Binary to open it and therefore "own" it. Only way ANYthing can delete Search.jar is to close Java Platform... one way or another.

I used Task Manager to stop the Java Platform... from executing, moved the old .jar file to the Desktop, and changed the shortcut to find this Desktop file. With no "old" file named search.jar, gradle was able to Clean and Build and finish normally.

So, all was well in Netbeans without exiting and restarting Netbeans!

P.S. From this experience, I wonder if the original error (NOT occurring during Clean and Build) was caused by Dictionary.dic being edited while the app was trying to create a new version of dictionary.dic (an option is to "rebuild" the app's dictionary), while gradle was trying to do whatever it does during execution of such a request.

DSlomer64
  • 4,234
  • 4
  • 53
  • 88
0

I solve the problem in a very easy way, just delete the hidden folder that you define when synchronizing google drive and it was solved, it was not necessary to restart the computer, just compile the project again and ready, if it fails, I recommend deleting the processes in the background and uninstall google drive and restart

Regards!!

.enter image description here

IngeArk
  • 41
  • 5
0

In case it is a Web Application with Tomcat (or another server), sometimes it looks in Netbeans like Tomcat is stopped, but Tomcat is still running. When Tomcat running it prevents nbbuild and dist folders and files in them from deleting.

In Task Manager locate java.exe process and end it.

Yuriy N.
  • 4,936
  • 2
  • 38
  • 31