ADM Blog

Static files locked by Jetty in Eclipse

jetty_logo If you use Jetty you might notice that once it's running you can't edit any static files because it says they are already in use and locked.
Why ? Because Jetty buffers static content for webapps such as html files, css files, images etc and uses memory mapped files to do this if the NIO connectors are being used. The problem is that on Windows, memory mapping a file causes the file to be locked, so that the file cannot be updated or replaced. This means that effectively you have to stop Jetty in order to update a file.

In case this happens follow these steps:

1. Extract the runjettyrun_1.0.1.jar in the eclipse plugin directory
2. Extract the jetty-6.1.6.jar in the lib directory of the previous jar.
3. Edit the file org\mortbay\jetty\webapp\webdefault.xml and change the "useFileMappedBuffer" to false. It should look like the following:

<init -param>
      <param -name>useFileMappedBuffer</param>
      <param -value>false</param>

4. Pack everything back up and overwrite the runjettyrun jar in the plugin directory.
5. If you still get the error after step 4 start eclipse.exe with -clean and then recreate the Jetty configuration. (It just need to replace whatever jar's it copies in your workspace .plugins dir)


View hidden files with a keyboard shortcut

HowToGeek has come up with an absolutely marvelous solution to quickly toggle the display of hidden files on your Windows computer. Often you have to view hidden files when making changes to system files or configuration files of softwares. Enabling the "show hidden files" option in Windows is a long process. The author of HowToGeek has coded a simple application in AutoHotkey script that runs in the background and toggles the status of the "show hidden files" option with a shortcut key combination - Win+H. There is no user interface to keep memory usage at a minimum, but you can customize with by editing the script which is provided on the site.

Once the application is running, all you have to do is hit the Win+H shortcut key.


And immediately any hidden files will become visible. Hit the same shortcut key and the folders become hidden again.


To make this application auto start, copy it to your startup folder C:\Documents and Settings\%username\Start Menu\Programs\Startup. Since there is no GUI, the only way to close the application is by killing the process through the task manager.

This application is going to make my life a lot easier. I wish it was available earlier. Download ToggleHiddenFiles.