views:

163

answers:

4

I built a Java application that is delivered on USB sticks. To ensure compatibility, I ship an appropriate JVM on the sticks. I made an EXE that simply invokes this JVM with the application jar.

Now the problem: some virus scanners act aggressively and just remove the executable!

I tried an exe made with a "Batch file to Executable" tool and one written myself in C (invoking ShellExecute); both versions are detected and eliminated by Norton SONAR but I can imagine other virus scanners might react similarly.

I initially opted for a windows shortcut but these don't seem to support relative paths. A batch file is not acceptable either since I don't want the command console to be shown.

A: 

Use start/b java.exe ... in a batch file. There will be a short flicker but the window will quickly go away.

As for the virus scanner removing your file: Use a stick that has a hardware switch which can make it write protected. It's for your own safety: just because there is a virus scanner doesn't mean there is no virus. If no one can write to the stick, no one can mess with it.

Aaron Digulla
The application saves data on the stick, so it cannot be write protected.
Wouter Lievens
Also, I see more than a flicker if I use start/b, actually no difference at all, sorry.
Wouter Lievens
A: 

If you launch your app using javaw.exe you shouldn't have an associated console window at all so that might get round the need to convert your bat file into an .exe.

You could also consider distributing your app as a Webstart app, whereby the associated jnlp file describes the minimum required version of the JVM.

Adamski
+1  A: 

Since the program won't have to change very often: Submit it as a false-positive to the AV vendors, then it will probably be white-listed quite rapidly. Or at least you might find out what it is that they find so objectionable.

Douglas Leeder
+1  A: 

You could try using one of the many configurable java launchers - they may be less likely to be picked up by AVs:

(full disclosure: i work on winrun4j)

Peter Smith
It ended up working with NSIS... I tried all the others but they all got picked off. Thanks!
Wouter Lievens