java获取classPath的路径

这里是获取classPath下的路径,和web没关系!!!
使用场景:
需要在java代码中把从网下下载到的图片写到本地的临时目录,写完后,上传到云平台,然后在删除掉。
String realPath = this.getClass().getResource("/").getPath()

你可能感兴趣的:(java获取classPath的路径)