How to clear the cache in NetBeans - netbeans

This question's answers are a community effort. Edit existing answers to improve this post. It is not currently accepting new answers or interactions.
I created a project in NetBeans, and I would like to clear the NetBeans cache.
I'm running NetBeans 7.0.1 on a Windows 7 machine.
How do I do this?

Close NetBeans before deleting the cache.
NetBeans 7.2+, Windows 7
Cache is located in C:\Users\<username>\AppData\Local\NetBeans\Cache\.
Clear the cache using the %USERPROFILE% Windows variable:
del /s /q %USERPROFILE%\AppData\Local\NetBeans\Cache\
If it is set, you can also use the environment variable %LOCALAPPDATA%:
del /s /q %LOCALAPPDATA%\NetBeans\Cache\
NetBeans 7.2+, Linux
Cache is at: ~/.cache/netbeans/${netbeans_version}/index/
Mac OS X
Cache is at: ~/Library/Caches/NetBeans/${netbeans_version}/
See also http://wiki.netbeans.org/FaqWhatIsUserdir.
Help Menu
On Windows, selecting the Help » About menu will display a dialog that contains the following text:
Product Version: NetBeans IDE 8.0.2 (Build 201411181905)
Java: 1.7.0_80; Java HotSpot(TM) 64-Bit Server VM 24.80-b11
Runtime: Java(TM) SE Runtime Environment 1.7.0_80-b15
System: Windows 7 version 6.1 running on amd64; Cp1252; en_CA (nb)
User directory: C:\Users\Username\AppData\Roaming\NetBeans\8.0.2
Cache directory: C:\Users\Username\AppData\Local\NetBeans\Cache\8.0.2
Regardless of operating system, the About dialog will contain the correct path to the cache directory.

The path of the cache directory is listed in the About window (menu Help/About). Close NetBeans, then delete (or rename) the directory. NetBeans will rebuild its cache when it starts up.

Before 7.2, the cache is at C:\Users\username\.netbeans\7.0\var\cache. Deleting this directory should clear the cache for you.

On a Mac with NetBeans 8.1,
NetBeans → About
Find User Directory path in the About screen
rm -fr 8.1 In your case the version could be different; remove the right version folder.
Reopen NetBeans

I'll just add that I have tried to resolve reference problems caused by a missing library in the cache, and deleting the cache was not enough to solve the problem.
I closed NetBeans (7.2.1), deleted the cache, then reopened NetBeans, and it regenerated the cache, but the library was still missing (checked by looking in .../Cache/7.2.1/index/archives.properties).
To resolve the problem I had to close my open projects before closing NetBeans and deleting the cache.

For Netbeans 7.4 and above in Linux, the cache is $HOME/.cache/netbeans/7.4.

In Window 7 the cache is located at C:/Users/USERNAME/AppData/Local/NetBeans/Cache

The NetBeans cachedir is a directory consisting of files that may become large, may change frequently, and can be deleted and recreated at any time. For example, the results of the Java classpath scan reside in the cachedir.
NetBeans 7.1 and older
By default the userdir is inside a (hidden) directory called .netbeans stored in the user's home directory. The home directory is ${HOME} on Unix-like systems, and %USERPROFILE% (usually set to C:\Documents and Settings\) on Windows. The cachedir can be found in var/cache subfolder of the userdir.
As the name suggests, the userdir is unique per user. For each version of NetBeans installed, the userdir will be a unique subdirectory such as .netbeans/.
To find out your exact userdir location, go to the IDE's main menu, and choose Help > About. (Mac: NetBeans > About NetBeans).
NetBeans 7.1 allows to separate the cache directory using a switch --cachedir to a desired location.
Examples
A Windows user jdoe running NetBeans 5.0 is likely to find his userdir under
C:\Documents and Settings\jdoe.netbeans\5.0\
A Windows Vista user jdoe running NetBeans 5.0 is likely to find his userdir under
C:\Users\jdoe.netbeans\5.0\
A Mac OS X user jdoe running NetBeans 5.0 is likely to find his userdir under
/Users/jdoe/.netbeans/5.0/ (To open this folder in the Finder, choose Go > Go to Folder from the Finder menu, type /Users/jdoe/.netbeans/5.0/ into the box, and click Go.)
A Linux user jdoe running NetBeans 5.0 is likely to find his userdir under
/home/jdoe/.netbeans/5.0/
For More Info
See this documentation at the NetBeans site: NetBeans 7.2 and newer

For NetBeans 8+ on Windows 10 there's a definitive bug with duplicate classes error which is being solved by cleaning the cache at
C:\Users\<user>\AppData\Local\NetBeans\Cache.

Just install cache eraser plugin, it is compatible with nb6.9, 7.0,7.1,7.2 and 7.3:
To configure the plugin you have to provide the cache dir which is in netbean's about screen.
Then with Tools->erase cache, you clear the netbeans cache.
That is all, good luck.
http://plugins.netbeans.org/plugin/40014/cache-eraser

The cache is C:\Users\userName\AppData\Local\NetBeans\Cache\, and then the version name of the folder will specify the correct cache.
You can also do this: Close the IDE. Instead, of deleting files and risking everything, rename this cache folder. Now start the IDE. Once it starts, a new cache folder will be created since the folder is not found. Now you can delete the renamed folder safely.

tl;dr
You might not need to whack your entire NetBeans cache.
My problem manifested as running a clean build didn't delete the previous build folder or testuserdir folder, while I was using NetBeans 8.0.2.
The first time I had this problem, Ray Slater's answer above helped me immensely. I had two Project Groups, and had to close each project in both groups, close NetBeans, clear the cache, then add my projects back to my groups before it would work again.
Later, this problem cropped up again with NetBeans 8.1. I closed NetBeans, and ran ant build clean at the command line, and it worked. When I reopened NetBeans, the problem was resolved. It occurs to me that NetBeans was keeping something open and just needed to be closed in order to delete the folders.
Update
I finally figured out what was going on. Somehow, my NetBeans "Module Suite Project" (yellow/orange puzzle pieces icon) had been closed and the "Module Project" (purple puzzle piece icon) having the same exact name as the "Module Suite Project" was open. Building clean cleaned that particular Project correctly, but did not clean the entire Suite.
Now that I have the "Module Suite Project" opened correctly again, things work as expected. This explains why ant build clean worked, since it was done on the command line at the right level to clean the whole Suite.
I suspect I didn't strictly need to clean out my NetBeans cache at all though perhaps doing so actually fixed the issue of why it was only showing the "Module Project" instead of the "Module Suite Project", thereby doing the right thing when I clicked build clean... If I had simply realized that the Suite was no longer open and only the Project was, I could have fixed it in three seconds.

I have tried this
UserName=radhason
C:\Users\radhason\AppData\Local\NetBeans\Cache
Press Ok button , then cache folder will be shown and delete this cache folder of netbeans.

Related

NetBeans background scanning projects takes too long

NetBeans background scanning projects takes too long. Every time when I open netbeans it scanning for ages. I used NetBeans 7.2 and it works perfecly. Now I formatted pc and reinstalled windows, install the same version of NetBeans 7.2, and it works to slow.
Having the same issue with 8.0.2 when a project has JS resources I tracked it down in my case to a problem with the javascript2 editor module which has been updated over the original version shipping with netbeans 8.0.2.
I simply solved it by removing the updated module.
On Linux:
rm ~/.netbeans/8.0.2/modules/org-netbeans-modules-javascript2-editor.jar
However, after letting the netbeans updater download the module a second time, the problem didn't appear again.
In Netbeans 8.1, the location of this file is at:
ide/modules/org-netbeans-modules-javascript2-editor.jar.
I have the same problem in netbeans but i found solution by unselect
the check from auto scan background
in your netbeans IDE go to tools and then Option and select then to miscellaneous and select file tab inside miscellaneous and
you will find check as "enable of auto-scanning of the source
unselect that one and netbeans will be fast then i hope it will help you
in fasting your IDE too
After latest update of Netbean 8.0.2 I have the same problem that scaning process did not stop and go forever with CPU usage on 25%.
When I replace javascrip editor files in C:\Program Files\NetBeans 8.0.2\ide\modules on Windows 7 with old one then scaning project process start work again. You can take those file from this repo.
i'm facing the same issue, but it works fine after increase the heap size by adding -J-Xmx2048m in <NETBEANS_DIR>\etc\netbeans.conf
mine looks like this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms2048m -J-Xmx2048m -J-XX:PermSize=32m ......
Try the following :
1) Go to Window-->Files. This opens the Files Tab.
2) In the Files Tab for each opened project open the nbproject folder and inside it open the project.properties file.
3) Now in this file below the property "excludes" there are file references listed for all your referred Libraries (JARs)
4) There might be some repeated file references with paths that may be old or on someone else's machine(if you are working in a group and transferred projects from someone's machine)
5) Delete those old path references.
Example -
excludes=
file.reference.xyz.jar=../not/correct/path.jar //delete this line
file.reference.xyz.jar-1=../correct/path.jar //remove -1
....
includes=**
6)Also locate the property "javac.classpath" and delete the unnecessary classpath entries corresponding to the deleted references as described above.
Example -
javac.classpath=\
${file.reference.xyz.jar}:\ //keep this line
${file.reference.xyz.jar-1}:\ //delete this line
....
javac.compilerargs=
7) So now the file reference mentioned in the file reference section and the javac.classpath property is same and points to a valid Library (JAR) address on your machine or network.
Example -
excludes=
file.reference.xyz.jar=../correct/path.jar //the correct reference & path
....
includes=**
....
javac.classpath=\
${file.reference.xyz.jar}:\ //the correct classpath entry for reference
....
javac.compilerargs=
....
The reason the above procedure worked (in my case) is because it prevents Netbeans from scanning unnecessary Library paths that may not be present on your machine/network.
On Windows 10 64bit I had the same problem with Netbeans IDE 8.1
I restarted Netbeans as administrator and the problem was solved. Then I closed Netbeans and started normally and the problem was still gone.
Product Version: NetBeans IDE 8.1 (Build 201510222201)
Updates: NetBeans IDE is updated to version NetBeans 8.1 Patch 1
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Windows 10 version 10.0 running on amd64; Cp1252; nl_NL (nb)
OS: Windows 7 x64.
The following worked for me:
I fully uninstalled Netbeans (ticked all boxes in uninstaller). For those who couldn't you'll need to go to C:\Users\%username%\AppData\Roaming\NetBeans\8.0.2 and delete a file called 'lock'. This is normally removed when the program exits but if you need to force terminate it'll remain there.
After that I uninstalled JDK and JRE then downloaded Java Platform (JDK) 8u40:
http://www.oracle.com/technetwork/java/javase/downloads/index.html
And Netbeans 8.0.2:
https://netbeans.org/downloads/
Installed JDK (which installs JRE too), after that Netbeans. Once complete I loaded up projects where background scanning got stuck and it seems to have fixed it. Will post updates if it starts happening again.
I actually made a bug report for this issue. It was fixed and pushed to the update channels yesterday. So for anyone still having this specific bug, let Netbeans check for updates. :)
Bugfix: https://netbeans.org/bugzilla/show_bug.cgi?id=250985
On Ubuntu 18.04 / Netbeans 10.0, I had the same problem.
[FAIL] Deleted cache
[FAIL] Deleted project-specific "nbproject" dir
[FAIL] Closed the offending project (mouseover the progress bar to identify which one) --> restart NB --> create new project
[SUCCESS] Nuked the project from the F/S --> re-cloned --> restarted NB. I also renamed the directory itself, in case there was some other cache that pointed to the old dirname.
Please try NetBeans 8.0.2 from https://netbeans.org/downloads/
NetBeans 7.2 is too old and you will not get any support anymore.
I was having the same problem with Netbeans 8.1, Windows 10. It was also hanging when I tried to compile and refactor. It would sometimes say 100% done yet continue background scanning for hours. I closed the project in which this was happening, and switched to a simple project and the problem went away. So I examined my code. I had class A extending class B, then class B importing class A. When I changed this, the endless looping in Ant stopped.
Always I fix such Netbeans related problems by deleting cache directory.
Directory location can be seen on About dialog window.
For me, the path is
C:\Users\USER\AppData\Local\NetBeans\Cache\YOUR_VERSION
This problem is related to one of the project opened in your IDE. As I had been facing the same issue but, after spending two hours on that issue I finally fixed that. Close project one by one or check and close the project where background processing is taking time. After closing the project delete the .nbproject folder and re-import the same project into your IDE.
It should be called foreground scanning of projects. Closing the program and restarting solves it for me sometimes.
I had the same problem but in my case I was on Windows 10 and running NetBeans 8.1.
Before I formatted my laptop I copied and backed up C:\Users\user_name\AppData\Roaming\NetBeans\8.1 and C:\Users\user_name\AppData\Local\NetBeans\Cache folders
Then i followed the below steps:
Install NetBeans and run it.
Closed NetBeans
Go to C:\Users\user_name\AppData\Roaming\NetBeans\8.1 and C:\Users\user_name\AppData\Local\NetBeans\Cache folders and replace them with the backed up folders.
Run NetBeans again
I hope this solves your problem!!
In my Laravel case ,got this "forever scanning" because the project was created in another IDE. I put the old IDE related folders .idea , vendor , node_modules into myproject->Properties->Ignored folders . Relaunched NetBeans as admin. It will scan a little bit but next time wont stick on that.

One of my project subdirectories has disappeared from Eclipse PHP Explorer and refuses to reappear

The subfolder myproject/wp-content has dissapeared from the project explorer (of course the files are still there, I can see them on windows explorer).
All the other folders and files are still showing up.
I tried deleting the project files (.settings .buildpath .project) and deleting the project on eclipse and also deleting the index on .metadata/.plugins/org.eclipse.dltk.core.index.sql.h2
What else can I do?
I'm using stock Eclipse Kepler 4.3.1 SR1 64-bit with the following add-ons:
Aptana Studio 3 Plugin 3.4.2.201308081736-7W7I57boG98RAi489ctbvKi7VXbq com.aptana.feature.studio.feature.group Aptana
ChromeDevTools SDK 0.3.9.201309080643 org.chromium.sdk.feature.group The Chromium Authors
Chromium JavaScript Remote Debugger 0.3.9.201309080643 org.chromium.debug.feature.group The Chromium Authors
Eclipse Standard/SDK 2.0.1.20130919-0803 epp.package.standard null
Line Number Ruler Fix (Eclipse Kepler 4.3) 0.0.1 de.cdhq.eclipse.linenumberfix.kepler.feature.feature.group CDHQ.de
Markdown Editor 0.2.3 markdown.editor.feature.feature.group Winterwell
Nodeclipse 0.5.0.201309080643 org.nodeclipse.feature.group Nodeclipse organization
PHP Development Tools (PDT) 3.2.0.201306051924 org.eclipse.php.feature.group Eclipse.org
Show Window in Fullscreen 1.1.0.200906152252 gr.scharf.fullscreen_feature.feature.group Michael Scharf http://michaelscharf.blogspot.com/
Word Wrap Feature 0.0.3 de.cdhq.eclipse.wordwrap.feature.feature.group CDHQ.de
[EDIT] I forgot to mention I've also tried to rebuild the project with the same results, and I've also checked explorer view filters in case something weird had happened but there are no filters set.
[EDIT 2] I deleted the Eclipse project files and the whole .metadata folder on the workspace and recreated the project. I had no problem at first, but it has happened again. I haven't touch any settings, just closed and reopened the project.
[EDIT 3] The less invasive fix by now seems to be a combination of deleting h2 database (.metadata/.plugins/org.eclipse.dltk.core.index.sql.h2 workspace folder) and deleting also the project without deleting its files which doesn't delete .build or .settings or .buildpath either, so it can be recreated without much hussle. I can avoid the problem by not closing the project (I can still close Eclipse without loosing the folder), but I still don't know what's causing it.
[EDIT 4] I updated Eclipse and plugins today to their latest versions (Now runnning Kepler 4.3.2) and the problem persists (even if I delete org.eclipse.dltk.core.index.sql.h2 and .settings, .buildpath, .project before importing the project's folder contents as a new project): I just close the project after eclipse finishes indexing it and when I reopen it wp-content doesn't show up any more (unless I force reindexing by deleting org.eclipse.dltk.core.index.sql.h2 again). I do believe this is WordPress related, since it only happens when indexing this particular WordPress deployment (maybe it's one of the plugins/theme files installed inside wp-content or something related to one of the xml files in the root folder, like sitemap.xml?).
For me this happened multiple times, on different project and different folders. Opening+closing or refreshing the project yield no success.
In my case, I have found out that this is related to the Working sets. It seems by default new subfolders and files of a project are not marked belonging to the set, so the project has a mix of old folders (included) and new folders (excluded).
There are two fixes I am aware of:
disable the working sets
Moreover, on large projects, having this mixed state working set made opening the folder structure (and other operations) very slow (3-5 seconds per level). Turning off the working set filter made it instantaneous.
edit the active working set and check the project's checkbox (which will check all subfolders).
This happens to me all the time. I'm on OSX and my projects are accessed from a mounted samba volume. I've found that if I:
open the project in eclipse
eject the samba volume
refresh the project (it will say it cant find it and ask if you want to delete
it... click no)
remount the samba volume
refresh the eclipse project
And the missing files/folders show up. If your folders are local, maybe just moving the project folder would do the same. Unfortunately, this happens very often, and seemingly more often for wordpress projects for some reason.
I'm working with a UI project (Dynamic Web Project) and my web folder keeps dissapearing too. I didn't knew what causes that.
The only thing I knew was how to reset my projet; deleting it from workpsace and reimporting it.
I know now what causes that but I have no answer on why it actually does it. I keep refreshing my workspace because I have some compressing that is done outside eclipse and for my workspace to update them I need to refresh... somehow, the freaking Close Project option is right under the Refresh option, without prompting... and this is when my folder dissapear; when I reopen it.
Try the Import Existing Project would be my guess!
Maybe that can help you find the how of it !
Hi i solve this problem by unchecking "Group by Namespaces" in the little triangle on the top-right of the php explorer.
Issue:
My app directory in my cake php application became invisible after some time. This is bad since all of my non-cakephp framework files reside therein!
My environment:
Macosx
Eclipse Kepler
WebServer: built in macosx in Library/WebServer/Documents which is symlinked to a dir in my home directory.
PHP plugin
What I tried first:
Deleted old project from UI ( retaining files on the file system )
cd'ed to root project directory and deleted eclipse artifacts like .settings, .project, etc
Recreated php project to find that the app directory is still missing!
What worked for me:
I renamed the directory from app to app_back using the terminal/linux command rn.
Eclipse immediate saw the new dir after a clean rebuild.
I renamed the dir back to app and performed another clean rebuild.
Et Voila
It seems that by upgrading Eclipse to last version (Luna), removing the project files (.settings, .classpath and .project) and creating a new project on a new workspace, I can close and reopen the project without having the folder missing from the project explorer.
It's not the solution I wanted (and don't need any more) but it's also a solution, so I'm posting it :-)

Problems creating WAR file (Access is denied) (and the archive is probably corrupt but I could not delete it)

Here is the error I'm having trying to build something in Eclipse 3.8 on Windows 7 Pro:
BUILD FAILED
C:\path\to\build.xml:140: Problem creating war: C:\path\to\war\abc.war (Access is denied) (and the archive is probably corrupt but I could not delete it)
Total time: 1 second
I found this already:
problems creating war file
However, I'm running Eclipse as Administrator. In theory, wouldn't this rule out UAC? How about anti-virus?
Eclipse is also installed in the following path:
C:\Users\me\MyCustomApps\eclipse-indigo\eclipse\workspace
The .war file was being written in a folder on the workstation. This folder was shared with a local CentOS VMWare instance. I had a terminal in CentOS that had that path loaded due to the fact that I had recently copied the .war file to my webapps folder.
I simply navigated away from this shared folder in the CentOS terminal window and was able to build the war file without any issues in Eclipse.
I had the same frustrating issue. My solution was, in Eclipse, disable the "Build Automatically" option under the Project menu...which kept regenerating the WAR file. After that, and a restart of Eclipse (not sure if that was needed), I noticed the file no longer existed in my workspace under that project. It showed up one last time under my Eclipse project, but at that point I was simply able to delete it and run a Maven Clean, which was successful. I hope that helps.
Eugene
I had the same issue. A Maven clean install created the target folder with Unknown user credentials. Normally deleting the target folder should solve the issue. In my case a system reboot let me delete the target folder and do a republish.
I was working in a CentOS terminal. Cygwin interferes with windows credentials which causes this Unknown user problem.
I also faced same issue. I increase the Heap Space in eclipse.ini file inside Eclipse folder and resolved the issue. -Xms512m
-Xmx1024m
Under Windows environment variables set MAVEN_OPTS=-Xmx1024m.
Then in Eclipse Set: Run Configuration -> Maven Build -> (select you Maven Launcher) -> Environment -> Append environment to native environment
It will work for me...
To resolve this issue, please deleted the existing war in the location and check whether the jboss instance is running or not. If it is running please stop the server and then do clean build of the projetc. Uncheck the build automatically in Eclipse.
It will work :)

How to tell Netbeans IDE not to open previously opened projects on startup

My netbeans seems to freeze every time I try to open it. It says waiting projects opened. I want to somehow clear the list of 'open projects' so that netbeans doesn't try and open them automatically on startup.
Maybe clearing the cache or something?
I'm running Netbeans 7.3 on Mac OS: X Mountain Lion
A little late, but I think
config/Preferences/org/netbeans/modules/projectui.properties is the file you are (were?) looking for.
Mine (Netbeans 8.1 on a GNU/Linux box) is located under %my_home_dir%/.netbeans/8.1/, like:
/home/scherrer/.netbeans/8.1/config/Preferences/org/netbeans/modules/projectui.properties
I've made a test renaming this file and when I opened the IDE no project was opened.
Clear netbeans cache:
Clearing the cache in Netbeans will probably cause it not to load previously opened projects: Clearing Cache in NetBeans
Clearing cache in Netbeans is not enough to avoid the load of the projects, instead you can close temporaly the projects.
With shift+Click you can select several projects to be closed:
I have the same problem and i solved it this way
Kill netbeans
Change the name of the folder where you have your projects
Open netbeans
re rename the folder to the original name
Open your projects one by one

Can't add server to a moved workspace

I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace.
When I select Tomcat v6.0 I get a message
Cannot create a server using the selected type
Older tomcat versions are available, though.
I guess I have to recreate some configuration setting. The question is which one? This seems to be some odd error as creating a new dynamic web project lets me configure tomcat for both of them
I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.
Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomcat version, click next and you'll see the incorrect path reference. Fix it. Move on.
I had this same problem on Ubuntu 8.10 with Ganymede and Tomcat6. This appears to be some sort of bug with Eclipse. If you try and create a server, and it barfs, you can't create another tomcat6 server. To correct this problem, do the following:
close eclipse
go to the {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings directory and remove a file called org.eclipse.wst.server.core.prefs.
start eclipse
add your tomcat6 server in the server tab
kotfu
#id thanks for the solution but something is also hidden in org.eclipse.jst.server.tomcat.core.prefs
So in order to solve the problem
close eclipse
go to {workspace-directory}/.metadata/.plugins/org.eclipse.core.runtime/.settings
remove the files org.eclipse.wst.server.core.prefs and org.eclipse.jst.server.tomcat.core.prefs
Tomcat 5.5
I order to be able to use the tomcat5.5 server you need to have a writeable catalina.policy file as mentioned in
http://dev.eclipse.org/newslists/news.eclipse.webtools/msg16795.html (= add a READ and WRITE permissions to the files in directory "{$tomcat.home}/conf" (chmod -vR a+rw {$tomcat.home}/conf/*). To be more specific, on the file "catalina.policy". After that, the Tomcat server can be added in the Eclipse servers)
(dead link) http://webui.sourcelabs.com/eclipse/issues/239179
and to have the tomcat5.5 stopped before entering eclipse and started afterwards.
Tomcat 6
In order to be able to use the tomcat6 server the proper solution is to have a user instance of the tomcat6 server as described in
/usr/share/doc/tomcat6-common/RUNNING.txt.gz
RUNNING.txt (on the WEB)
My configuration is Debian/Sid, Eclipse 3.4.1. Ganymede
The error view really is key. There is a lot of detail in there -- if necessary, right-click on the entries and copy their contents into your favorite text editor. One problem that can come up, for instance, is that if you have a server configuration already in place, and one of the configuration XML files is unparseable, the server can't be added. This happened to me this evening -- my <Context> element had a linebreak in it, so it was <C(linebreak)ontext>. This prevented Eclipse from recreating the server configuration.
i finally got mine to work with the default Ubuntu 8.10 tomcat. (the debug command-line on eclipse is a wonderful thing) First i had to make a couple of symbolic links and then change the permissions to a file. (you might want to think twice about changing the permissions depending on your configuration, but if eclipse can't read the file it throws and exception and the gui won't let you continue)
sudo ln -s /etc/tomcat6 /usr/share/tomcat6/conf
sudo ln -s /etc/tomcat6/policy.d/03catalina.policy /usr/share/tomcat6/conf/catalina.policy
sudo chmod a+r /usr/share/tomcat6/conf/tomcat-users.xml
Hum it can tricky. Bring the "server" view. If your project has already been deployed, remove it from the server to clean the binding between your project and the server.
Or you can right-click on your project in the project explorer and choose debug on the server. If you don't done it already, Eclipse should ask you to create a server runtime and here you can specify Tomcat 6 and specify the location of your server installation.
You can also see the "problems" view to see any problm in the project imported like the JDK etc...
Look in the error view. If you tried to set one up once and failed, Eclipse seems to try and look there again later just before allowing you to create a new one. If you've deleted the folder or its not there any more, you need to replace it so that you can proceed.
The only way I found to use the Tomcat 6 is changing the ownership of the Tomcat directory to my user. It seems that is not enough to have r/w permissions.
BTW, removing org.eclipse.wst.server.core.prefs erases you workspace configuration.
I had had same problem until I went to tomcat6 configuration directory and added ownership to my user in addition to root:
cd /usr/share/tomcat6/conf
chown root:myusername ./*
chmod 777 ./*
You can choose some better chmod for security, 777 is just a quick brutal fix.
I have Eclipse 3.5 (Galileo) + Fedora 12 + Tomcat 6 extracted from tar(which is why Eclipse could not access it). Eclipse had been complaining "Cannot create a server using the selected type".
What version of Eclipse? Europa? Ganymede?
What do you mean by workspace? An Eclipse workspace is not something you deploy, it holds your projects.
You will need to generate a WAR file (or the folder of files that would comprise the WAR file), a project would typically include an ANT or Maven build script to do this, or if the project used Eclipse's Dynamic Web Project type there might be a 'generate WAR' option somewhere. Without further details I can't help any more.
Adding a new dynamic web project to the workspace seems to 'unlock' the feature.
Changing the ownership to my user worked for me.
In my case, it was the corrupted Tomcat configuration files. Eclipse log was saying:
org.eclipse.core.runtime.CoreException:
Could not load the Tomcat server configuration at
C:\Program Files\Apache Software Foundation\apache-tomcat-6.0.14\conf.
The configuration may be corrupt or incomplete.
Got a new Tomcat distribution, removed the old one and all good now.
Finally got this problem solved on my system.
1) got rid of the apt-gotten tomcats
2) installed a typical tomcat from bins at tomcat.apache.org
3) got rid of my openjdk
4) installed the sun jdk (apt-get)
5) removed my web projects in eclipse
6) noticed that when adding a web project you can set "Target Runtime" - I tried setting it to Tomcat 6 and it let me know there was a problem
Maybe none of the above mattered, but here's what might have mattered:
7) KICKER: Window -> Preferences -> Server - Runtime Environments. Removed any crappy runtime environments here, and added the path to my newly installed tomcat.
This Question is maybe old. But I just ran into this problem. My project was not recognized as a web project (no globe icon in Eclipse ).
Suppose you use maven plugin , it failed to convert to web project with command
mvn eclipse:eclipse -Dwtpversion=1.5
In package Explorer, right-click on the project / configure / Convert to Java Facets project/ Dynamic Web project in Eclipse
Et Voilà
Check the .project file at the root before and after the convert.
You will see new natures.
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
Instead of deleting config settings files, just go to Preferences -> Server -> Runtime Environments and remove the "forgotten" environment....
Thanks a lot this answer working for me..
I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.
Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appropriate tomcat version, click next and you'll see the incorrect path reference. Fix it. Move on.