• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use Windows Task Scheduler to run Java Application

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What values do I put in the Run: and Start In: boxes to run a Java program? My java.exe is in

C:\Program Files\Java\jre1.5.0_06\bin\java.exe

and the class file is in

C:\Documents and Settings\lname-fname\My Documents\Eclipse_Workspace\Java_File_Copy\copy_Files\CopyFile2.class

How do I pass arguments? Must I specify my current passwaord? Is there a better (free) way to schedule Java applications?

Thanks in advance,

John
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could always put everything in a batch or wsh file and have task scheduler run that.
 
Marshal
Posts: 28177
95
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
In "Run" you put something like

"C:\Program Files\Java\jre1.5.0_06\bin\java.exe" -cp ... yourpkg.yourclass param1 param2

exactly the way you would type it at the command line. In "Start In" you put the name of a directory that will be the current working directory when the class runs. If it doesn't matter what the current working directory is, then you can leave that blank. Put directory names in quotes if they have spaces, as in the example above. And if it asks you for your password, give it your password.
 
John Howard
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Martin:

I created the following MyJava.bat file in the root (C directory:

"C:\Program Files\Java\jre1.5.0_06\bin\java.exe" "C:\Documents and Settings\howard-john\My Documents\Eclipse_Workspace\Java_File_Copy\copy_Files\CopyFile2.class"

when I execute this .bat file, the DOS window opens and closes to quickly for me to read, but doesn't work.

Paul:

From the DOS prompt, I did CHANGE DIRECTORY (cd) to point to the directory in which my CopyFile.class module is located, then did

java CopyFile2


it told me that there was an error in "main" - class not found.

Any suggestions?

Thanks again for your help.
 
reply
    Bookmark Topic Watch Topic
  • New Topic