Jar issues with Task Scheduler

Any Windows (preferably 7) users out there with extensive Task Scheduler experience?

I'm trying to get away from wrapping my jar file to an exe (among other things, this allows me to execute it in 64-bit Java, but jsmooth only gives me 32-bit)

Now, when I go through the loops in the command line to test it, the following works as expected:
"C:\Program Files\Java\jre6\bin\java.exe" -jar C:\Users\goddess\Documents\Bots\OB\KoLmafia.jar

However, when the same parameters are loaded via the task scheduler, I get a brief error, then it quits.
It starts:
Exception in thread "main" java.lang.UnsatisfiedLinkError: [path to folder]/images/TrayIcon12.dll: Can't find dependent libraries
And then proceeds to list where it was at when this occurs.
(sorry, my attempts to pipe the error to output failed) so, here's the screencap I got before it went away.

Any ideas how to fix this or otherwise allow task scheduler to invoke a jar?

EDIT: To clarify, this only seems to occur if I use the optional "Start In:" field. Which I would like so that my mafia files aren't being held up in the Java program file.
And I seem to be having Java issues all around, I'll post more when I fix that.
 

Attachments

  • je.png
    je.png
    45.5 KB · Views: 258
Last edited:
So... when I run the .jar from the folder it's built into (/dist) it runs just fine.
However if I copy/paste the file to the folders I'd like to run it from, it ... doesn't do anything when I double click. I get the loading icon for a second or two, then nothing.
Any clues?
 

roippi

Developer
I tried replicating your problems with task scheduler using "java -jar ..." and couldn't. So looks like it's a java installation problem.

Is it possible that you're working with two copies of java here? Try "where java" at a command line.
 

xKiv

Active member
Which user is it set to run under in the task scheduler?
Does that user have

What value do you put in the "start in" field?

Which Java are you using (sun's? other? which version-cum-patchlevel?)

Can you call a .bat (or .cmd) file and start it with a "cd ..." command?
your line in that .cmd file would then look like
"C:\Program Files\Java\jre6\bin\java.exe" -jar C:\Users\goddess\Documents\Bots\OB\KoLmafia.jar >c:\users\goddess\Documents\Bots\OB\log1.txt 2>c:\users\goddess\Documents\Bots\OB\log2.txt




Did you copy the TrayIcon32.dll into that [path to folder]/images/ ?
I see it inside KolMafia.jar, sitting at top level ...
 

fronobulax

Developer
Staff member
Which user is it set to run under in the task scheduler?

+1

My guess is that it is a function of the user environment loaded by the task scheduler when it runs. mafia is not finding the directories it expects.

If I am right, I have used two different workarounds in the past. One is to explicitly set the user the task runs as and hope the necessary parts of the environment are loaded. The other is to wrap the command in a bat file where the first line is a CD to the directory with the mafia files. The first option usually requires storing a password for an account which is a PITA if passwords get changed with any frequency. The second option means there is a helper file that has to be created and "maintained"
 
Top