• samgdavisne (2/26/2015)


    Hello,

    I am using SQL server 2012 and the operating system is windows server 2012 64 bit.

    I am trying to run a batch file from a SQL server agent job. I have the job set up as Type: Operating system(CMDExec), and my command is cmd.exe /c "C:\SQLProcesses\Occupancy.bat".

    Everytime I run the job I get the error: 'java' is not recognized as an internal or external command, operable program or batch file. Process Exit Code 1. The step failed.

    The batch file itself runs fine when I double click on it, and I can run it from the windows task scheduler just fine.

    Does anyone have a suggestions on how I can get the batch file to run from SQL Server Job agent.

    Thanks,

    Sam

    Check your java path on Windows.

    Based on the error you gave, it seems to me that when running as a TSQL job, SQL server cannot find the path for Java. You may have to add it or correct that.