• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

JAR file runs when double-clicked, but not via Task Scheduler?

 
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

OK, so, I have my JAR file on a WS2003 machine, and when I double-click on the JAR or run it from the command line, my program executes just fine. The JAR is on the root of my C drive; C:\CMMS_SCADA.jar. I've created a daily scheduled task for this JAR, and when the clock rolls around to its execution time, the task status shows as 'running', but the program does not run. The scheduler is scheduled to run:

"C:\Program Files\Java\jdk1.6.0_13\jre\bin\java.exe" -jar "C:\CMMS_SCADA.jar"

and start in:

"C:\Program Files\Java\jdk1.6.0_13\jre\bin"

Am I missing something?

Thanks in advance, as always.
 
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What makes you think the program doesn't run? Perhaps it does run but the results of its running weren't what you expected.
 
James Brooks
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Paul,

The program creates a .csv file. When run manually, the .csv is output, which I can tell from the file attributes (time created). It does not output the file when the task scheduler supposedly runs it.

Paul Clapham wrote:What makes you think the program doesn't run? Perhaps it does run but the results of its running weren't what you expected.

 
Ranch Hand
Posts: 268
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try using the AT command.
 
Paul Clapham
Marshal
Posts: 26912
82
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

James Brooks wrote: The program creates a .csv file. When run manually, the .csv is output, which I can tell from the file attributes (time created). It does not output the file when the task scheduler supposedly runs it.


No, that just tells you that it didn't work right. You know the task scheduler ran it, so presumably something bad happened and the program crashed. That suggests to me that something is different between your environment and the task scheduler's environment.

By the way, you said it worked correctly when you ran it from the command line. Does it work correctly when you run it from the command line with C:\Program Files\Java\jdk1.6.0_13\jre\bin as the current directory, or did you try it with some other current directory?

And does the command line run the application under your user profile or some other user profile. Could that make a difference?

I'm sure there are plenty of other environment differences that could exist. Keep looking for them.
 
James Brooks
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK, thanks for the help :-) I changed the task scheduler's profile for that task to my domain admin login, and voila! I was confused because that username is the same for the local machine and the domain. Now, I'm getting that silly mail messaging exception (class not found) again when it runs, but only when either the task scheduler runs it, or when I navigate to the directory you named below and run it from there. Any thoughts? It apparently has to do with the mail.jar file. I did a search for mail.jar on the entire computer, and got quite a few results. See screenshot of search results if you like; I have a feeling that this a .jar file placement problem, or maybe it is in a directory it should not be and is causing a conflict.

Paul Clapham wrote:

James Brooks wrote: The program creates a .csv file. When run manually, the .csv is output, which I can tell from the file attributes (time created). It does not output the file when the task scheduler supposedly runs it.


No, that just tells you that it didn't work right. You know the task scheduler ran it, so presumably something bad happened and the program crashed. That suggests to me that something is different between your environment and the task scheduler's environment.

By the way, you said it worked correctly when you ran it from the command line. Does it work correctly when you run it from the command line with C:\Program Files\Java\jdk1.6.0_13\jre\bin as the current directory, or did you try it with some other current directory?

And does the command line run the application under your user profile or some other user profile. Could that make a difference?

I'm sure there are plenty of other environment differences that could exist. Keep looking for them.

Untitled.gif
[Thumbnail for Untitled.gif]
 
James Brooks
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, is there a good resource to learn about the different paths within the JRE/JDK directories? I'm still clueless about this part of it.
 
James Brooks
Gunslinger
Posts: 165
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bump
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic