我知道经常会遇到类似的问题。但是这些解决方案并不适用于我。我确实尝试过jcifs.jar(版本1.3.17)。在这里,我发现它极其缓慢,并且由于某种原因,有时会挂起。由于我非常绝望,我可以极其缓慢地应对(并且祈祷不可靠)。但现在我还有一个问题,我需要压缩网络驱动器上的一些内容。这不适用于jcifs或我不知道如何。我的最佳解决方案是复制调用.bat来执行复制(这不起作用,因为它无法找到驱动器)。并调用7za.exe来压缩它(不会找到驱动器)。 示例代码:
public static int SevenZip(String source, String dest, ServletContext context) throws IOException, InterruptedException
{
String zipFile = "\"" + context.getRealPath("") + "\\WEB-INF\\7za.exe\"";
String zipInstruction = zipFile + " a " + dest + " " + source;
Logger.getAnonymousLogger().info(zipInstruction);
Process process = Runtime.getRuntime().exec(zipInstruction);
StreamGobbler errorGobbler = new StreamGobbler(process.getErrorStream(), "ERR");
StreamGobbler outputGobbler = new StreamGobbler(process.getInputStream(), "OUT");
errorGobbler.start();
outputGobbler.start();
return process.waitFor();
}
如果不作为servlet完成,代码将起作用。 忽略StreamGobbler它只是从进程中获取错误和输出流。 我在某处读到可以将tomcat设置为Windows身份验证,但我不明白在哪里以及如何。这对我有帮助吗?怎么样?
答案 0 :(得分:0)
我找不到jcifs的替代品。结果不是最佳的,但似乎没问题。我不认为这是jcif的错误,更多的是网络,我对此没有任何影响。