Java class in *.bat can be run by double click but not task scheduler.
What's the problem? Classpath or something else?
What should I do?
Java class in *.bat can be run by double click but not task scheduler.
What's the problem? Classpath or something else?
What should I do?
The .bat file probably sets the environment. Just run the .bat from the task scheduler.
Write a Shell or bat script that executes your jar and put this in your task scheduler.
Java .class files normally cannot be run via a double click; JAR archives can, but only through the association of the file type with a JVM executable. They're like Word documents - if you "execute" those with a double click, what actually happens is that Word is started and given the document as input.
If you want to run a JAR archive in the task scheduler, you'll have to do call the JVM executable like this:
C:\Program Files\jre6\bin\javaw.exe -jar C:\wherever\program.jar
Running Java .class files can be done like this as well, but you'll have to drop the -jar switch, use -cp to specify the classpath and in the end put the class name, not the file name, i.e. something like "com.initech.app.MainClass"