I'm encountering an issue with a legacy COM object that was developed for local use within my company (I don't have the source code). I have a Java program that interacts with this COM object, specifically calling a method that involves another language.
I created a batch file to run this Java program via a scheduled task. Here's the problem:
- When the task is set to "Run only when user is logged on" (interactive logon), the program produces the expected result.
- When the task is set to "Run whether user is logged on or not" (as a batch job), the program returns
null
.
The Java environment I'm using is JRockit v1.6 x86, and I interact with the COM object using JACOB Dispatch, sending an ActiveXComponent of the COM object.
Things I've Tried:
- Simplified the code to only interact with the COM object—no change in behavior.
- Printed all accessible properties from the COM object—properties are identical in both methods.
- Tried logging in as different users—same result.
- Used PowerShell to interact with the COM object—works as expected in ISE, but returns
null
in the PowerShell console.
- Attempted to run the Java program as a service account—again,
null
is returned.
- Printed from within the language method—this prints successfully.
Any insights or suggestions on why this discrepancy occurs and how to resolve it?