All of my "folders" were being showed as packages and so on one of my packages, I hit "use as source folder" which converted it into a folder but seems to have make all other folders fall inside that folder...Is there any way to revert this change? After that I hit exclude from build path and it did some other weird thing. I'm not experienced with eclipse and probably screwed everything up.
ScreenShot :
http://i.gyazo.com/4846d8c628e3e6a9973b557884c0a74f.png
Right click on src folder->Build Path->Remove from Build Path. Then again right click on src folder->Build Path->Use as source folder.
Related
In JBoss (Eclipse) I am having a problem with my src files showing up in the src folder in the package explorer. As you can see from the picture on the left there is nothing in the folder for test, and no java files under main, but webapp. For example though I went to where the files are stored and show you that there are infact tons of files inside of the test folder. Any idea how to get them to show back up in the Package explorer in eclipse?
edit: srry forgot pic
In Eclipse, make sure the filter is not turned on to hide types of files you're looking for. Under Package Explorer, click the small down arrow to the top right of your listed projects. In that list, select Filters... then make sure you're not filtering out the files you're looking for. Checked items are hidden from your view.
Otherwise, the picture you've said you posted, I can't see. So I'm sort of guessing what the problem really is here.
EDIT: OK, I see the picture now.
Java files are shown under src/main/java at the top of the package explorer. If you right-click the project name, select Build Path -> Configure Build Path... and select the Source tab, you can see which folders have been designated as containing java source files.
Files in those folders will have been filtered out from the main "plain" type folders. Eclipse treats stuff marked in "source" folders differently. Mainly, it will attempt to compile java files it finds there.
Solved it, It was just that I was in regular Java perspective instead of the JBoss perspective. Honest silly mistake. Thanks for the replies though!
I'm attempting to run an already existing eclipse project created by another person.
After importing it to eclipse, and attempting to Run As->Java Application, it fails because it cannot find a .properties file in bin/resources
I printed out the classpath eclipse was using
logger.info(System.getProperty("java.class.path"));
and sure enough, it includes bin, and all the lib/*.jars, but not bin/resources. Copying the .properties file into bin makes the program work, but I wanted to understand how to add a directory to the eclipse classpath.
I tried several things, none of which worked
export CLASSPATH=$CLASSPATH:/home/me/programdir/bin/resources
This didn't work. I understand it's not a desirable way to approach the issue, but I had thought it would fix the problem (I have more of a windows than linux background so perhaps I am missing some nuances of system variables in linux)
Next up, I tried modifying the VM arguments in the Run->Configurations dialog in Eclipse
-classpath "/home/me/programdir/bin/resources"
No luck here either, which confused me, as I was sure it would work and seemed like a reasonable solution to a specific program needing one additional folder added to the classpath.
Next I tried modifying build.xml directly. I found the part that defines the classpath and added my own line for bin/resources, as follows:
<path id="classpath">
<fileset dir="./bin/resources" includes="**/*.properties"/>
<fileset dir="./lib" includes="**/*.jar" />
</path>
this too was unsuccessful. This perplexed me even more, so I commented out the entire path element, and the classpath printed out by the logger was unchanged, so it is apparent that whatever classpath eclipse was using, it certainly wasn't this one. This seemed to me the best solution, had it worked: the build.xml file could be checked in with the correct additions to prevent future users from experiencing the problem.
Next I tried the IDE approach. Run->Configurations->Classpath-> User Entries->Advanced and simply added the bin/resources folder. That worked perfectly, the program finds the properties file, all is well. However, I am dissatisfied that my previous efforts failed without me really understanding why. It seems that each one should have worked.
Additionally, I want to ensure that I fix this problem in such a way that it is captured by the code I check in so that subsequent users do not have to go through the same steps. My solution is thus not very satisfactory as I am not sure what actual piece of code changed, and thus cannot verify that the 'fix' is checked in.
How do you find the actual definition that eclipse is using for its classpath? I had thought it would be the build.xml classpath definition, but that did not seem to be the case at all.
In Eclipse, there is a build classpath and a runtime classpath. There is also the build output location, which by default is bin. You don't want to add resources directly to bin because Eclipse can delete its contents when doing a clean build. What you need to do is add a resources folder in your project to contain any non-Java files that you want included in your build output.
To include the contents of this resources folder in the build output (bin), right-click the project and select Properties. In the Project Properties, select the Java Build Path section, then the Source tab.
Use the Add Folder... button to select the resources folder from your project, then OK to save the changes. At that point, Eclipse will automatically copy everything from resources into bin when it builds.
This is for a maven project:
Right click on project
click on run configurations
click on the classpath tab (Oxygen Eclipse)
click on user entries
click on Advanced
first radio selection default should be 'Add Folders'
click OK
Follow these steps to get this issue fixed:
Right click on Project
Click on Run As and select Run Configurations
Click on the classpath tab (Oxygen Eclipse)
Click on user entries
Click on Add External JARs.. and choose the downloaded JAR file
Click Apply and run your project...
Right Click on the project-name in Package Explorer, select Properties, select Java Build Path on the left, select Source tab on the right, click on Add Folder, browse through the project's directories to select the resources folder or whatever you need to add to the eclipse classpath, hit OK, again hit OK. Done.
If you don't want the properties file to be copied to the bin folder, you can try the following:
Right click your project, select Build Path, select Configure Build Path..
Select Libraries tab
Select Add class folder..
Add your resource folder.
Seemingly out of the blue (although I think it happened inexplicably after an ant build) my Eclipse IDE stopped resolving the Java class names of those I have created inside my project, giving me a nice list of red 'x's in my package explorer.
I'm not sure how or why this happened, and I'm having a hard time getting Eclipse to see them again. Under project properties the source tab in Java Build Path references is src dir as you would expect. In comparison the Referenced Libraries have all the jars I use and those are not giving any issue. How could I resolve it?
1)Right Click on Project , navigate to Build Path and then click Configure Build Path
2)Now click on tab Sources , there you have to verify that the programs under the folder src , is stated in the Sources tab correctly.
Lets say my project name is EmpService , and my programs are in src folder (forget about package , in fact package must be under src) , then the tab would be showing like this-
EmpService/src/
Regards
Anshul
I have three different projects in my eclipse and yesterday src file became unvisible in one of the projects. Two days ago it was ok and I have no idea how this happened. I can not see src file in project explorer or package explorer.
Project Explorer :
However, if I look with navigator I can see all files in the directories.
Navigator :
I use Eclipse Indigo SR2 and IBM Rational ClearCase for first two project. The other is my local test project.
Do anybody know how can I get back to src file into the project explorer?
Thanks.
Try to right-click on the project and click on refresh.
I had the same problem today, it is because i switch to wrong view model.I suggest you to switch the project explorer to Package Explorer.
Check your Java build path to make sure the src is present. Right click the project and select Build Path -> Configure Build Path. If the src directory is not present in the build path, it will not show up under the Java area as you have shown, but it will be present in the Navigator.
I had the same problem in Neon - src folder had disappeared. One sub-directory in the src folder would show up but no other sub-dir and not the parent src file itself. No matter what I did in the buildpath configuration only the one sub-dir would show up. It looked like some kind of corruption in the settings. None of the above solutions worked for me, including deleting the project and all files, and then re-checking it out.
What did work was switching to an old workspace, importing a project and then switching back to the workspace with the issue. Magically, the project with the problem was again responding to my changes in the buildpath configuration. I'm not sure if I had to do the interim step of importing fromt he old workspace or not - possibly just switching back and forth would have worked but not sure.
Try removing (deleting) the project without removing the files (there is a checkbox that allows you to keep the project files).
Then re-import the project. Not sure if this will solve your problem, but I was facing the same issue and delete->re-import resolved it for me.
I had this problem today, and the issue was that the "src" folder was not correct in the "Source" tab of "Configure Build Path" window. It was there but the path was wrong, so it had a red X. Deleting that entry and re-adding the "src" path (from the project) resulted in putting the "src" folder back into the packages hierarchy.
In my case, this happened because of sharing the workspace between user accounts, the paths to the workspace and the folder beneath were not the same. One user accessed the workspaces locally, the other as a mapped drive, etc.
Fixing this and then standardizing the path to be identical for all who access sit, resolved the underlying problem that caused this issue to surface.
Restart your eclipse work space.
Also change open perspective in eclipse.
In eclipse I have an error related to my build path.
The error:
Project 'XX' is missing required library: 'middlegen-2.1.jar'
But the library is deleted before the build path configuration.
Is there perhaps a problem with cache or so?
Has anyone an idea why eclipse say that the library is required even though the library was deleted before the build path configuration.
With Best
I guess you've deleted the library from a directory, but you've not updated the project Build Path. Right click on the project name, select "Properties", go to "Java Build Path", choose the "Libraries" tab, and see that your library is not in the list. If it's still in that list, remove it with the "Remove" button.
This error is due to probably either missing required library or due to caching of eclipse
Solution 1
Open project explorer window.
Right click on the project and goto Buildpath -> ConfigureBuildPath
Under the libraries tab check whether all the used jar files are physically located in the directory/web application library.If something is showing "RED X" mark then fix them by either putting the jar in the place or remove it or add it newly using add JARs
Solution 2
1.Try cleaning the project's using Menu->Project->clean (select the projects and clean it)
Solution 3
If your build path is very clear i.e no Red "x" marks then the error could be of eclipse caching.Then do below step
1.Right click on the project choose "close project".
2.Once the project is closed again right click on the project select open project
This solution will clear the eclipse cache.
Hope any of the solution should resolve your problem.
I had this same problem, but the steps above didn't help. I did a search through files in the Eclipse workspace and found files named .markers and .markers.snap that contained the bad path names under the folders in .projects that were named for the projects that weren't building. I exited Eclipse, backed up those files, removed them from the Eclipse workspace, and restarted Eclipse. The problem went away.
Your project configuration includes a reference to middlegen-2.1.jar on the build path. That file is missing. You can either a) put the file there, b) change the configuration to point to the file in another location, or c) remove the reference, cross your fingers, and hope the project compiles and runs without the jar.
I don't know what "the library was deleted soon" means, so if that is important to your question, you might want to rephrase.