Basically, my program runs along side another jar file. Here is the code for the download function:
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();
}
}
}
And the to start the new process
public void runUpdate() throws IOException{
String folder = fileLocation;
ProcessBuilder p = new ProcessBuilder();
p.command(folder);
p.start();
}
However, even with user prompts and having to approve the download, when I tested it outside of the eclipse environment, my anti-virus picked it up right away.
It was detected as a "trojan.downloader". I'm thinking it has something to do with the download function? I'm not really trying to beat an anti-virus program. I'm not attempting to do any illegitimate.
Perhaps some obfuscation would do the trick?