String currentClassPath = RandomCheckCode.class.getResource(File.separator).toString();
int beginIndex = currentClassPath.indexOf("/", 0)+1;
int endIndex = currentClassPath.lastIndexOf("/")+1;
String OS = System.getProperty("os.name").toLowerCase();
if(OS.indexOf("win")!=-1)
beginIndex+=1;
System.out.println("path: "+ currentClassPath.substring(beginIndex, endIndex));
评论
发表评论

您还没有登录,请登录后发表评论

jayuton
搜索本博客
最近加入圈子
最新评论