cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Batch file to execute a Java program when method server starts

Highlighted
Granite

Batch file to execute a Java program when method server starts

Hi

I have a utility program on Windchill - deployed and working.

I want this program to start running as soon as the method server starts and stops as soon as the method server stops.

Adding to the contents of this example, I added the following commands to run the java program right after windchill starts:

     cd C:\ptc\Windchill_11.0\Windchill

     java ext.mypackage.utilityClass


The error: "unable to find or load main class" appears.

However, running the command java ext.mypackage.utilityClass on Windchill shell directly works as it should.

So, why does the batch file fail to do the same?

Tags (1)
1 REPLY 1
Highlighted

Re: Batch file to execute a Java program when method server starts

You batch file is running in an environment that does not have all the same environment variables configured that exist when a Windchill shell is created.  See this:

Re: Rehosting Tool - Automate Extra Tasks

Starting in Windchill 11.0 PTC has created another bat file that can be called to configure the current shell environment just like a Windchill shell.  This means you could start your script, run this extra bat file, then continue with your custom code and it will behave just like you had started it from a Windchill shell.  See this for more info:

https://support.ptc.com/appserver/cs/view/solution.jsp?n=CS230143

Announcements