How to get the required .jar file when launching DITA-OT from Java program?

7 views
Skip to first unread message

Toshihiko Makita

unread,
Jul 3, 2021, 7:35:19 AMJul 3
to DITA-OT Users
Hi list,

I'm developing a Java program which accept transformation type (transtype) and DITA-OT directory from user parameter and launch DITA-OT automatically.

According to the DITA-OT API page:


This page says that it is caller responsibility to set up the classpath when call this API.

However I'm not sure how to get the required .jar file from DITA-OT information.

The candidate may be:
  1. [DITA-OT]/lib/*.jar (This is basically needed)
  2. <feature extension="dita.conductor.lib.import" file="lib/xxx.jar"/> described in [DITA-OT]/config/plugins.xml (plug-in specific .jar file)
But I realized that some plug-in uses extension and the relevant plug-in needs its own .jar file. (ex. transtype="pdf" needs [DITA-OT]/plugins/org.dita.index/lib/index.jar) At this moment, I'm not sure how to get this .jar file path from transformation type.

Are there any recommended algorithms to get required .jar by Java program?

Any suggestion is welcome!

Regards,

-- 
/*----------------------------------------------------------------------------------
 Toshihiko Makita
 Development Group. Antenna House, Inc. Ina Branch
 Web site:
 http://www.antenna.co.jp/
 http://www.antennahouse.com/
 ------------------------------------------------------------------------------------*/ 

Toshihiko Makita

unread,
Jul 3, 2021, 10:45:46 AMJul 3
to DITA-OT Users
Reply to myself.

DITA-OT have bin/dita command that launches specific plug-in. If you open the [DITA-OT]/bin/dita.bat, you can see following lines:

:checkJava
rem Set environment variables
call "%DITA_HOME%\config\env.bat"

[DITA-OT]/config/env.bat file sets all of the .jar file required in the plug-in to CLASSPATH.

So dita.bat command does not set plug-in specific CLASSPATH. Rather it sets all of the .jar files defined in [DITA-OT]/config/plugins.xml file.

This was the trick.

I could succeeded to launch PDF plug-in from my Java program.

Regards,

Toshihiko Makita
2021年7月3日土曜日 20:35:19 UTC+9 Toshihiko Makita:
Reply all
Reply to author
Forward
0 new messages