当我使用FileSystems加载zipfile时,发生sysout错误。 我知道有人使用zipfileclass解压缩,但是JDK8有新的API,我想使用它。
我想解压缩jar文件,所以我尝试使用FileSystems.newFileSystem,但是当我运行代码时,系统提示错误信息。
Private Sub CommandButton1_Click()
Application.ScreenUpdating = False
Dim xSheet As Worksheet
Set xSheet = ActiveSheet
If xSheet.Name <> "Definitions" And xSheet.Name <> "fx" And xSheet.Name <> "Needs" Then
If xSheet.Range("E10")="Y"
xSheet.Range("E6:E200").Copy
Worksheets("Sheet1").Range("E6:AZ6").PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=True
xSheet.Columns("E").Delete
Else
MsgBox("Data entry not ready!")
End If
End If
Application.ScreenUpdating = True
End Sub
系统信息:
public static void unJAR(Path source, Path targetDir) throws IOException {
FileSystem fileSystem = FileSystems.newFileSystem(source, null);
Files.walkFileTree(fileSystem.getPath("/"), new SimpleFileVisitor<Path>() {
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path targetFile = Paths.get(targetDir.toString(), file.toAbsolutePath().toString());
Files.createDirectories(targetFile.getParent());
Files.copy(file, targetFile, StandardCopyOption.REPLACE_EXISTING);
return FileVisitResult.CONTINUE;
}
});
}