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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Batch file to execute a Java program when method server starts

smorla
11-Garnet

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?

1 REPLY 1
TomU
23-Emerald IV
(To:smorla)

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

Top Tags