---
title: "如何在eclipse中直接调用windchill的API"
author: "aindf0128"
date: "2010-10-15T11:32:15Z"
tags: []
categories: ["行业应用"]
slug: "eclipse-windchill-api"
draft: false
lastmod: "2010-10-15T11:33:45Z"
id: 785598
url: "https://aindf0128.iteye.com/blog/785598"
---

**如何在eclipse的Java Project中直接调用windchill的API并运行程式**：

 

Alias：WC\_HOME = \*:\\ptc\\Windchill\_9.1（\*指具体的某个盘符）

1.         要引用windchill的jar包，如下：

       1.1          %WC\_HOME%\\Windchill\\codebase\\WEB-INF\\lib

       1.2          %WC\_HOME%\\Windchill\\lib

       1.3          %WC\_HOME%\\Java\\lib\\tools.jar

 

2.         在main方法里加上下面这一段（授权）：

       RemoteMethodServer rms = RemoteMethodServer.getDefault();

       GatewayAuthenticator auth = new GatewayAuthenticator();

       auth.setRemoteUser("wcadmin");

       rms.setAuthenticator(auth);

 

3.         Project -&gt; Build Path -&gt; Configure Build Path -&gt; Libraries -&gt; Add Class Folder

（%WC\_HOME%\\codebase），这样在更改了java文件或者properties文件之后可以不用重启tomcat而直接运行程序。

 

注：windchill版本为9.1