0
votes

I get a Exception in thread "main" Exception in thread "main" java.lang.NoClassDefFoundError error when I try to run a batch file as a scheduled task on windows server 2008. The batch file runs a java program. when I run the batch file regularly it runs fine.

@ECHO OFF

:start

:playback
java -cp ../lib/*; example

:end

Tue 08/30/2011 9:29:23.19: C:\Windows\system32;C:\Windows;C:\Windows\System32\W bem;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files \Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\ DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Com mon7\IDE\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program F iles (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Windows \System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Imaging\;C:\Pro gram Files (x86)\IBM\Director\cimom\bin;C:\Program Files (x86)\Common Files\ibm\ icc\cimom\bin;C:\Program Files (x86)\IBM\Director\bin;C:\Program Files\System Ce nter Operations Manager 2007\ ;C:\Program Files (x86)\Java\jdk1.6.0_25\bin;C:\Pr ogram Files\System Center Operations Manager 2007\

1
Does the account the scheduled job runs under have the necessary permissions?aphoria
What class does it not find? If it can't find the "main" class, that means it cannot load a particular class referenced by that class (possibly including itself). You need to add all necessary references to your classpath so it can find them.Chris Aldrich

1 Answers

1
votes

The account that runs the batch does not seem to have its PATH configured properly. Can you add:

echo %DATE% %TIME%: %PATH% >> %TMP%\DebugFile.txt

to see that the value in path.