我在 Windows 7 上使用 Eclipse IDE 和嵌入式 Jetty Server。
我可以通过启动码头运行该应用程序并在我的浏览器中毫无问题地查看它。
但是,如果我在我的应用程序中编辑“webapp”文件夹中的文件,例如 JavaScript 文件,我会收到以下错误
Could not write file: sample.js
sample.js (The requested operation cannot be performed on a file with a user-mapped section open)
如果我停止 Jetty,我可以保存文件。那么有没有办法阻止 Jetty 锁定文件呢?
这是我在 JettyServer.java 中创建 WebApp 上下文的方法
private static WebAppContext createWebapp() {
String webAppDir = "src/main/webapp/";
WebAppContext webApp = new WebAppContext();
webApp.setContextPath(CONTEXT_PATH);
webApp.setResourceBase(webAppDir);
webApp.setParentLoaderPriority(true);
return webApp;
}