我正在尝试重命名图像文件播放框架的 public/images 文件夹。我尝试使用 play.getFile() 和 viirtualFile 类,无论我使用什么,我最终都会遇到以下异常。如果我遗漏了什么,请告诉我。
VirtualFile vf = VirtualFile.fromRelativePath("path to public/images/old file name.jpg");
File file = vf.getRealFile();
file.renameTo(new File("path to public/images/new file name.jpg");
错误:
play.exceptions.UnexpectedException: While applying play.CorePlugin@450b9338 on controllers.Admin
at play.plugins.PluginCollection.enhance(PluginCollection.java:556)
at play.classloading.ApplicationClasses$ApplicationClass.enhance(ApplicationClasses.java:235)
at play.classloading.ApplicationClassloader.loadApplicationClass(ApplicationClassloader.java:167)
at play.classloading.ApplicationClassloader.getAllClasses(ApplicationClassloader.java:431)
at play.Play.start(Play.java:516)
at play.Play.detectChanges(Play.java:630)
at play.Invoker$Invocation.init(Invoker.java:198)
at Invocation.HTTP Request(Play!)
Caused by: play.exceptions.UnexpectedException: While applying class play.classloading.enhancers.ContinuationEnhancer on controllers.Admin
at play.CorePlugin.enhance(CorePlugin.java:302)
at play.plugins.PluginCollection.enhance(PluginCollection.java:551)
... 7 more