File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Performance and the fly likes the first java program runs very slow Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "the first java program runs very slow" Watch "the first java program runs very slow" New topic

the first java program runs very slow

Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
The first java application/applet runs very slow (4 - 10 min) after PC boot up. Subsequent java program is OK (less than 1 min). The problem is due to Sophos anti-virus software. The first Java program triggers Sophos anti-virus software to run and the anti-virus program takes about 100% of CPU. So the other program just hang there. Anybody can help me to solve this problem. Thanks.

Best Regards,<br />DongShan<br /> <br />SCJP1.4, SCWCD1.4
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199


Welcome to JavaRanch!

Perhaps your antivirus program can be configured to ignore whatever activity is taking so long; or perhaps you can switch to a different antivirus program. I would say this is a question for the makers of this virus software.

[Jess in Action][AskingGoodQuestions]
Ranch Hand

Joined: Dec 05, 2004
Posts: 48
Try to diminish the priority of the thread that triggers the anti-virus process...and see if that helps.

Thanks,<br />Bhanu<br />SCEA Step-I<br />SCBCD for J2EE 1.3<br />SCJP1.4
Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
Ernest, Bhanu, thanks for your reply.

Because the antivirus software is corporate standard software, we cannot change it currently. There is not a setting in Sophos software to ignore the particular program like Java also. Unless we disable the antivirus software, but it cannot be done.

I think that the problem is not due to Java program itself but JVM. When JVM start, the antivirus program is triggered. So only first running Java program is affected. Not only application, but also applet.

Is there a way to start JVM (e.g. Java web start) when boot up and continue to activate it until PC shutdown?
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Virus-software sounds like windows-pc.

Start a dummy application in your autostart-group.
Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
I disable the option "Scan inside archive files" in Sophos antivirus software, the problem is solved.
Mahesh Rana
Ranch Hand

Joined: Sep 05, 2001
Posts: 139

Disabling the Archive scanning will hide realy viruses also.
So, that is not the best solution.

Stefan's suggestion is the right approach.

Start a dummy "Hello World" app on statrup, it will take care of scanning your or rt.jar .....

Cai DongShan
Ranch Hand

Joined: Dec 07, 2004
Posts: 102
Thanks, Deep and Stefan. Deep, you are right. Disabling the Archive scanning is not a good solution.

Because our Sophos antivirus software is updated (update/close/start) once or twice per day, depends on how often the virus definition is updated. We need to run the dummy program not only at the boot up time, but also after antivirus software updating. I don't know how to run the dummy program automatically after software updating.
I agree. Here's the link:
subject: the first java program runs very slow
jQuery in Action, 3rd edition