Running a JAVA program as a scheduled task

Solution 1:

I Think that you could create a simple batch script that will launch your program in this way :

@echo off
REM Eventually change directory to the program directory 
cd C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\
REM run the program
"C:\Program Files\Java\jdk1.7.0\bin\java.exe" -jar "C:\Users\User1\Documents\NetBeansProjects\Facebook\dist\Facebook.jar"

Copy it into the notepad and save as java_script.cmd and then schedule this script instead of the program directly.

Solution 2:

I solved it after changing all fonts' references to "SansSerif"

I was using Jasper Reports inside Java to create a PDF file. It was working fine when I double click the batch file or Scheduler with Windows Server 2003 but not working with the Scheduler of 2008.

I tried many different things nothing worked so I though Could it be that Windows Server 2008 is blocking the access?.

Now is working perfect. So, if you are having problems check the references to anything you are using.