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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Ant script to load and compile .java files

smorla
11-Garnet

Ant script to load and compile .java files

Hi,

I have a File uploading utility that loads WTDocuments to Windchill.

I want to load this package onto Windchill and compile it using ant script.

So far, I have managed to copy the package (which is a bunch of .java files) onto the src folder using the following ant script:

  

<target name="taskUnzip">

          <unzip src="${packagestructure}/myuploadutility.zip" dest="${wc_src}"/>

</target>

I use the following task to compile it:

<target name="compile">

  <javac srcdir="${wc_src}" destdir="${wc_codebase}"/>

  </target>

But this throws several errors similar to :

\myuploadutility.java:5: error: cannot find symbol

    [javac] import com.ptc.netmarkets.model.NmOid;

    [javac]                                ^

    [javac]   symbol:   class NmOid

    [javac]   location: package com.ptc.netmarkets.model

So I think I am writing the tasks the wrong way. So, how to load the package, compile it, so that the .class files get stored in codebase?

Please help.

Thanks in advance.

Note: I know it's possible to make a jar file of all the .class files directly and put them into codebase. However, requirement specifies a .zip file containing .java files only.

3 REPLIES 3
BineshKumar1
13-Aquamarine
(To:smorla)

You have a compilation error in your myuploadutility.java. It is not an issue with the task. You are importing a package that is not in the class path.

Hi Srinivas Morla

I have not that much exposure to Ant script, but if you wish you can give it a try to compile using below command.

This command will compile classes for you and also place them in respective packages under codebase

tools class -Dclass.includes=ext\**

I am assuming ext is your customization directory under <WT_HOME>\src folder.

Regards,

Shirish

Hi Shirish,

This worked! I ran the ant script to put the java files in the src folder and used the command line to compile them.

Thanks for your help.

Announcements

Top Tags