Can't compile due to missing files - java

I get the following message:
The project was not built due to "File not found: path/.DS_Store.".
Fix the problem, then try refreshing this project and building it since it may be inconsistent
This is a error message I've never seen before. I'm running Eclipse Indigo on a Mac OSX with Lion. As far as I understand the message my .DS_Store file is responsible for me not being able to compile, but how can that file mess with my code?!
Maybe what's interesting or not:
My file structure is as follows:
com.packagename
And it says File not found: bin/com/.DS_Store. It can't find the .DS_Store file in my binary output folder?

Try to refresh the project in the Project Navigator (F5 or Right click/Refresh).
These error messages are most likely caused by modifications in the file system outside Eclipse (e.g. external builder, or vcs tool is used), and Eclipse detects during the build that the file is changed.
Alternatively, if you are using a recent enough Eclipse, you could try two settings in the Preferences that might help in these cases as well: check Refresh using native hooks and Refresh on access in General/Workspace page in the Preferences dialog.

Related

FileNotFound exception after fetch, even though file exists in VSCode

I'm currently using GitHub desktop to fetch changes, and then opening the project in VSCode.
For whatever reason, any new files that come with the fetch throw FileNotFound exceptions after compiling (even though I can see the files in the project folders). If I go into a file, make an edit and save it the issue goes away and the compiler sees the files again.
Is there a way to "Refresh" the project files after a fetch. I am assuming a file pointer isn't resolving in some backend code somewhere.
Any advice is appreciated
Open Command Palette and choose Java: Clean Java Language Server Workspace then reload window.

The project was not built due to "Could not delete '/Help/build/classes/exportFile'.".

When I imported my project in Eclipse Oxygen, it gave the below error.
"The project was not built due to "Could not delete '/Help/build/classes/exportFile'.". Fix the problem, then try refreshing this project and building it since it may be inconsistent"
Googled and got that to delete the contents of the bin folder and clean the project. But there's no bin folder. Tried cleaning, still the same error. What else can be done
You found a solution yourself, but here are some more informations about this error.
First, you said, your search brought up answers where deleting the bin-directory manually solves this but you don't have this directory. Reason for that is that you configured your project to write classes to the classes-directory (bin is the default).
The "cannot delete" message appears mainly on Windows systems if there is another process keeping a lock on the directory or files within. The classic reason for that is that you currently run the application or that you have an Explorer window open that shows the content of this directory. Closing the application/Explorer window normally solves the problem. Sometimes the lock keeps staying. A way to find the culprit is using Sysinternal's ProcessExplorer. It allows you to search for it by using Find->Find handle or DLL. The result can be clicked on and you can even forcefully close that entry, releasing the lock (some programs don't like that but I never had any problems doing that).
But sometimes it's actually necessary to reboot the system if you can't get rid off the lock otherwise.

The selected file is a system file that cannot be modified

I started getting the following error in RAD 9.1.1(websphere 8.5) since yesterday. Also this error is coming on only one project in my workspace. I do have about 7-8 projects which are clean- no errors. Any help or input on this is appreciated..
The project was not built due to "Internal error - the selected file
is a system file that cannot be modified. It will be hidden.". Fix the
problem, then try refreshing this project and building it since it may
be inconsistent
Issue resolved, goto Target, compiled classes folder of that project and DELETE copyarea.db and refresh your project. The error is because the RAD copies the read only files ".copyarea.db" to the classes folders and during cleanup, RAD fails to delete these files.

Eclipse - Source not found

I know this question has been asked many times before, but none of the proposed solutions resolve my issue (or I'm not implementing them correctly).
I'm developing a plugin for OpenFire, and when I set a breakpoint in my plugin source Eclipse reports "Source not found". The JAR is built separate from the build of the OpenFire server. I've tried adding the JAR and specifying the source code directory, but no dice.
Here's the process I'm following: When I hit my breakpoint I'm clicking "Edit Source Lookup Path", clicking "Add", Java Library, User Library, click User Libraries, adding my library (tried both "Add JARs" and "Add External JARs"), and then specifying the folder that contains the source code. I've also tried:
Adding the source by selecting "File System Directory" instead of "Java Library"
Adding it by selecting "Workspace Folder"
In the Project Explorer, adding the source for my plugin to the Java Build Path
In the Project Explorer, adding my JAR as a Library and specifying the Source attachment
Thanks in advance for any suggestions.
Personally, I have no good experience in Eclipse JDT, when adding a source folder at the time it hits a break point. What I always prefer to do, is adding the source folder before debugging:
Select Project/Properties/Libraries
Select your library and "edit..." the source attachment
Select either the corresponding source folder or the zip/jar containing the package
After that, you should be able to open the source files in the virtual "Referenced Libraries" folder (directly below the "JRE System Library" folder inside the project), or when opening a reference to a linked class file from within the JDT editor. If you are able to access the source, then you should also be able to at least stop at the break point and see the corresponding source.
Else, you will have to check again, if the source folder is really valid: The source folder or source archive must contain the folder with the name of the root package of the library (e.g. the default Java "src.zip" inside the JDK folder also includes a corresponding "java" folder at its root). When in doubt, extract the archive and select the parent folder of the package you are interested in - sometimes source archives might be a mess or incompatible to JDT.
If this has been assured and it still doesn't work, chances are, that your linked source folder does not correspond to the compiled version of the library. Usually JDT will handle such inconsistencies fine, but if you try to open a source file, that is entirely different than the corresponding class file, you will encounter problems. In this case I would suggest either downloading the correct source version of the library, or recompiling the library from the source, if all else fails.
If opening a referenced source file from withing the JDT editor does work fine, and you are still unable to open the source files when a break point is entered during debugging, then most likely the class files are missing the line numbers of the corresponding source file. Again, you will have to recompile the library from the source in this case.
Finally, it is also possible to overwrite the default source lookup by specifying source folders or archives in the source tab of the launch configuration. But you should normally not need to do this, when your build path is configured correctly. From the Eclipse Help:
The Source tab defines the location of source files used to display source when debugging a Java application. By default, these settings are derived from the associated project's build path. You may override these settings here.
I had this very annoying problem for a long time but was finally able to solve it. In my case, a null pointer exception was being thrown somewhere in Java's Transformer.IsRuntimeCode(ProtectionDomain) function.
I didn't really need to know about this since the exception was being caught and handled, but eclipse would pause debugging every time this happened and tell me that the source wasn't available. As a result, I constantly had to keep pressing the button to continue code execution.
In order to prevent this from happening, I:
1. Clicked on the "Breakpoints" window at the bottom of the debugging
screen
2. Right clicked "NullPointerException"
3. Unchecked "Caught"
This prevented the debugger from pausing program flow during a caught NullPointerException.alt text
(source: SharpDetail.com)
And this another one as:
Eclipse doesn't crash. You're trying to step into a method, where eclipse doesn't know where to find the source (*.java) files and informs you about this. Here is how to tell eclipse where to look. Go to
Window->Preferences->Java->Installed JREs,select the JRE you are using and click Edit.
There, select all of the jar files in the list you see and and click Source Attachment....
In the window that shows up, select the fille src.zip, which is in your JDK folder (if you didn't uncheck it while installing the JDK). On the machine I'm on right now, that is
C:\Program Files\Java\jdk1.7.0_07\src.zip.
Save all your changes (possibly restart eclipse) and you won't see that error again.
Well it turns out the solution was anticlimactic. When Balder's recommendations did not work I tried debugging one of the stock OpenFire plugins and it worked just fine. I then created a new plugin from scratch, and by doing nothing other than adding the source to the project (Right-click on the project -> New -> Source Folder) it also worked just fine. I have no idea why Eclipse refuses to see the source for my original plugin, but I moved all my code and libraries over to the new plugin and debugging is working as expected.
Many times you put jar files in eclipse IDE as referenced libraries when binary version of application was downloaded. Usually done so by configuring the build path. But the binary does not have the source files. You have Binary version and source version of application.
One simple way is to download the source libraries that you also use maven to build the project.
Keep somehwere, may be inside your project workspace.
Now while seeing the class file (from eclipse, jar exploded) you may see the source not found, fine.... there is a button below and click on that, a new window opens and there select add external folder.
Reference it to the src folder of the source you downloaded(not the binary one) and kept somewhere as said above and it will show the class details from that.
I fixed this issue with doing the following:
Click at the menu Window - Preferences - Debug - Step Filtering And check all the packages like the following image.
(Step Filtering)
Then, debug again your project and thats it.
Best regards,
In my case, I had a breakpoint in the class declaration. I mean in the next line.
public class GenerateInterface implements JavaCall {
So, the debugger stopped in that line and showed the following message:
Source not found
I think unconsciously activate the breakpoint in that line.

Eclipse run old version of program

I have a problem while runing my application in eclipse. I make some edits like this:
String res = "newvalue";
System.out.println(res);
But when I run the application I still receive "oldvalue" in output. After this I tried to delete main() function - and I run application and I see "oldvalue" in output again.
Maybe it's some cache in JVM, or smth. else?
UPD:
It's 15:35 on my clock now. But in /bin folder I see .class files with 14:33 timestamp. I change source files (.java), press ctrl+f11 in eclipse and files in /bin folder are still 14:33 ...
UPD2:
After cleaning the project I receive the following problem:
The project was not built due to "Could not write file: D:\projects\NelderMead\bin\ru.". Fix the problem, then try refreshing this project and building it since it may be inconsistent
SOLUTION
The problem was that eclipse can't write file to the folder with spaces and UTF chars in it's name. So, I copy project to the new clean workspace and it runs without problems! Thx all for help detecting the problem!
You're executing an older class files, the reason could be
a compile error somewhere else (see problems view)
or your changed accidentally the source path so that the new source no longer gets compiled.
Try to clean the project and make sure the new classes are compiled to your output folder.
The JVM doesn't have a cache for class files.
First, make sure the file is saved (there is no asterisk next to the file name in the tab). Usually files are saved automatically, but you could choose not to save files and never ask by mistake, the first time Eclipse pops up this dialog.
Then see what's going on in the Problems view. You might see something like project cannot be built due to the following reason. It may be because of compilation errors in the dependent projects.

Categories