/** * 获取类路径 * *
@Return */
public static String getClassPath() {
String path = Thread.currentThread().getContextClassLoader().getResource("").getPath();\ return path.replace("\\", "/");
}
先获取webapp的绝对路径再说,获取到之后加个commons-io包,然后读写文件也就一行代码的事,而且数据库有嵌入式数据库可以用的,比如derby,sqlite,h2