How to build a Javahelp .jar with oxygen

Having trouble installing Oxygen? Got a bug to report? Post it all here.
klein
Posts: 3
Joined: Wed Jun 30, 2010 12:12 pm

How to build a Javahelp .jar with oxygen

Post by klein »

Hi again,

I have another problem. I'm not able to create a Javahelp .jar file with my oxygen installation.

What I have done:
I opened the "Configure Transformation Scenario" dialog, selected "DITA OT transformation" and clicked on "New". Then I selected "Javahelp" as type and started the transformation.

Result: The Javahelp output is generated but the jar file is not created.

My idea was that this is an additional advice for the ant script. Before using oxygen I transformed my content via the DOS commandline with a build.xml with the follwing lines:

Code: Select all

<property name="jarfile" value="${outdir}/javahelp/manual.jar"/>
...
<jar destfile="${jarfile}" basedir="${outdir}/javahelp" includes="**">
I tried "dita2javahelp" as "build target" in the "Advanced" tab but this resulted in a transformation error:

Code: Select all

 [pipeline] java.io.FileNotFoundException: http://java.sun.com/javase/technologies/desktop/javahelp/toc_1_0.dtd
I read in the manual but I couldn't find a hint where I can tell oxygen to create the jar file. Is there an option I can simply turn on or do I have to write a custom build script and include it?

Thanks for any help in advance.

Regards
Radu
Posts: 9447
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to build a Javahelp .jar with oxygen

Post by Radu »

Hi,

You do not need to (and should not) change the target in the Advanced tab from the scenario configuration dialog. If you do that, a lot of necessary targets will not get executed before the JavaHelp jar gets created.

Just open the OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/build_dita2javahelp.xml file in Oxygen and in the target called dita2javahelp after the line:

Code: Select all

<antcall target="compile.Java.Help"></antcall>
add the following lines:

Code: Select all

<jar destfile="${dita.map.output.dir}/${dita.map.filename.root}.jar" basedir="${dita.map.output.dir}">
<include name="**/*"/>
</jar>
Oxygen 12 will probably contain this patch to the DITA Open Toolkit by default and build the jar file out of the box.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
alrts
Posts: 3
Joined: Thu Aug 12, 2010 11:51 am

Re: How to build a Javahelp .jar with oxygen

Post by alrts »

This patch worked once for me. Then I added a topic and now I'm getting:

BUILD FAILED
C:\Program Files (x86)\Oxygen XML Editor 11\frameworks\dita\DITA-OT\build.xml:59: The following error occurred while executing this line:
C:\Program Files (x86)\Oxygen XML Editor 11\frameworks\dita\DITA-OT\build_dita2javahelp.xml:16: A zip file cannot include itself

Line 59 in build.xml points to:

<antcall target="dita2${transtarget}"></antcall>

Line 20 in build_dita2javahelp.xml points to:

<target name="dita.map.javahelp" depends="dita.map.javahelp.init, dita.map.javahelp.toc, dita.map.javahelp.map, dita.map.javahelp.set, dita.map.javahelp.index, dita.out.map.javahelp.toc, dita.out.map.javahelp.map,dita.out.map.javahelp.set, dita.out.map.javahelp.index"></target>

Any clues on that one ?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to build a Javahelp .jar with oxygen

Post by sorin_ristache »

Hello,

You have to exclude the jar itself from the content of the jar. The <jar> element should be:

Code: Select all

<jar destfile="${dita.map.output.dir}/${dita.map.filename.root}.jar" basedir="${dita.map.output.dir}">
<include name="**/*"/>
<exclude name="${dita.map.filename.root}.jar"/>
</jar>

Regards,
Sorin
alrts
Posts: 3
Joined: Thu Aug 12, 2010 11:51 am

Re: How to build a Javahelp .jar with oxygen

Post by alrts »

Yes, that's it. Thank you very much!

I have just encountered a minor problem:

upon processing the DITA OT Javahelp Transformation, all existing .html files are overwritten with the new version, but the

...Bookmap.jar
...Bookmap_helpset.hs
...Bookmap.jhm

files are not overwritten. Before each run I have to manually delete them in order to get the new ones.

I would like to have them overwritten. Is there a way to do that ?
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: How to build a Javahelp .jar with oxygen

Post by sorin_ristache »

Did you look at the timestamp? Are they not overwritten or are they overwritten with a file with the same name and content? The .hs and .jhm files should be created again by the DITA-OT stylesheets that are called by the JavaHelp transformation and overwrite the old ones.

The jar file should be overwritten every time by the jar element regardless of its previous existence because you did not add the update="yes" attribute on the jar element.


Regards,
Sorin
alrts
Posts: 3
Joined: Thu Aug 12, 2010 11:51 am

Re: How to build a Javahelp .jar with oxygen

Post by alrts »

You are right. I misinterpreted the Windows 7 column "Date" in the explorer. It seems to be the same as "Date created". When I look at "Date modified" I can see that it is overwritten.
jalu
Posts: 4
Joined: Thu May 19, 2011 4:54 pm

Re: How to build a Javahelp .jar with oxygen

Post by jalu »

Hi,

I also have a problem with building the javahelp and I hope you can help me.
I use the dita2javahelp transformation scenario and the commonltr.css file. The output is generated correctly, but changes within the css file have no effect to the output (if I open it with hsviewer). If I open the single html files, the format is correct.

What is my fault?

Thanks in advance for your help.
Jana
Radu
Posts: 9447
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to build a Javahelp .jar with oxygen

Post by Radu »

Hi Jana,

Basically if you make modifications in the CSS:

OXYGEN_INSTALL_DIR/frameworks/dita/DITA-OT/resource/commonltr.css

they should be reflected in the Java Help output.
For example I added an extra CSS selector like:

Code: Select all

 p{
color:blue;
}
to change colors for all paragraphs and the setting was reflected in the JavaHelp output.
Can you try to make the same change and see if the output JavaHelp contains the change?

Not all the CSS properties are supported in a JavaHelp viewer so it might be a case in which the viewer just does not support the CSS properties set in the CSS file.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jalu
Posts: 4
Joined: Thu May 19, 2011 4:54 pm

Re: How to build a Javahelp .jar with oxygen

Post by jalu »

Thanks for your quick response, Radu :)

Yes, I tried the commonltr.css from the resource folder.
Perhaps the property "color:#FF0000" is not supported in Javahelp? That`s what I tried.

Unfortunately I can`t test your css code until friday but I`ll let you know if it works.

Maybe you know a documentation with css properties supported in Javahelp?

Best regards
Jana
Radu
Posts: 9447
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to build a Javahelp .jar with oxygen

Post by Radu »

Hi Jana,

The strange thing is that I re-tested today the same CSS selector which worked for me yesterday:

Code: Select all

p{
color:blue;
}
and I could not get it to work (although it did yesterday).
The modifications were present in the jar file.

I also need more time for tests, I will update the post if I find a solution.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jalu
Posts: 4
Joined: Thu May 19, 2011 4:54 pm

Re: How to build a Javahelp .jar with oxygen

Post by jalu »

Hi Radu,

here are my test results:
Color modifying with your css code works fine for div=p (also with hex code).

But if I change the color for example for div=note, there is no effect on the output.

Maybe some DITA elements can`t customize with css?

Regards,
Jana
Radu
Posts: 9447
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to build a Javahelp .jar with oxygen

Post by Radu »

Hi Jana,

There is a misunderstanding, the CSS can only be used to customize the HTML output.
So your CSS selectors should not match like this:

Code: Select all

note{
color:blue;
}
because the final HTML will contain no trace of the original note element.

By default when a DITA <note> gets published to HTML it becomes something like:

Code: Select all

<div class="note note">.....
So the original @class attribute of the note will migrate to the @class attribute of the <div>, intentionally to make styling possible in the CSS.
You can test this in your own HTML output.
So if you want to style the note in the HTML output the CSS selector should be like:

Code: Select all

div[class~="note"]{
...............
}
I am not sure the JavaHelp viewer supports this selector but it's the proper way to do this.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9447
Joined: Fri Jul 09, 2004 5:18 pm

Re: How to build a Javahelp .jar with oxygen

Post by Radu »

Hi,

The second time I tried to test styling the elements in the JavaHelp output I had a DITA paragraph like:

Code: Select all

<p>Paragraph text <note>The note</note></p>
and I could not get styling to work on the p selector.

It seems there are also problems in the output when an element breaks the current layout, in this case the note is a block level element and breaks the paragraph flow in order to be visually rendered on a new line.

After I changed my example to:

Code: Select all

<p>Paragraph text </p><note>The note</note>
I could properly style the paragraph.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
jalu
Posts: 4
Joined: Thu May 19, 2011 4:54 pm

Re: How to build a Javahelp .jar with oxygen

Post by jalu »

Hi Radu,

thanks for your test cases ;)
I think I can customize the output in a proper way now.

Best regards,
Jana
Post Reply