基本上,我的程序与另一个jar文件一起运行。这是下载函数的代码:
public void saveUrl(final String filename, final String urlString) throws MalformedURLException, IOException {
BufferedInputStream in = null;
FileOutputStream fout = null;
try {
in = new BufferedInputStream(new URL(urlString).openStream());
fout = new FileOutputStream(filename);
final byte data[] = new byte[1024];
int count;
while ((count = in.read(data, 0, 1024)) != -1) {
fout.write(data, 0, count);
}
} catch (Exception e) {
return;
} finally {
if (in != null) {
in.close();
}
if (fout != null) {
fout.close();
}
}
}
开始新过程的第一步
public void runUpdate() throws IOException{
String folder = fileLocation;
ProcessBuilder p = new ProcessBuilder();
p.command(folder);
p.start();
}
然而,即使有用户提示并需要批准下载,当我在eclipse环境外进行测试时,我的反病毒软件立即检测到了它。
它被检测为“trojan.downloader”。我认为这可能与下载功能有关?我并不是真的想打败反病毒程序。我没有试图做任何非法的事情。
也许一些混淆会起作用?