Newbie question -- installing jing on a mac

138 views
Skip to first unread message

Jane Butterfield

unread,
Jun 12, 2019, 8:48:20 PM6/12/19
to PreTeXt support
I have been setting up my work computer for PreTeXt work, and all of the things I need to install are going just fin...other than jing.

The step I'm failing at is setting my `JAVA_HOME` environment, and I suspect it is failing because I have not actually obtained the JDK from Oracle that I thought I had. I wonder whether that is related to their new licence that started April this year, because I'm not convinced anything actually installed (I cannot find it). Sadly, I suspect it's just caused by me not installing things properly and not understanding terminal commands (both are things I know I limp through). Evidence: when I ask which java I get the same reply now as I did before attempting to obtain the JDK, namely /usr/bin/java 

I've read through and attempted to replicated the first few steps in the jing readme file, but they're listed explicitly only for linux and for windows and I don't have the command-line literacy to work out what to do for mac. As suggested in the pretext author guide subsection on jing-trang, I also tried the two suggested echo commands, both of which responded with No such file or directory.

I'm going to walk away from this for the day, and strongly suspect it's not the sort of thing someone can help me with without looking over my shoulder. It's probably fair to say that if I cannot work out how to get jing sorted then I shouldn't be reporting any errors that would require me to use it anyway! I certainly have everything set up well enough to author, which is my immediate goal.

Mitch Keller

unread,
Jun 13, 2019, 10:56:00 AM6/13/19
to pretext...@googlegroups.com
I think this is my turn to help, since I suspect I’m one of the few hard-core validators who uses macOS :)

Here are my suggestions:

* Don’t worry about what which java returns. Mine (macOS 10.14.5) returns /usr/bin/java as well.
* That echo $(/usr/libexec/java_home) fails definitely indicates a problem. I think you’re right that you’ve not got the JDK installed correctly. I would suggest going to https://jdk.java.net/12/ and getting the open source JDK. Unfortunately, it comes without an installer. Fortunately, you really don’t need one. Unzip the file you download until you have a directory called jdk-12.0.1.jdk. Put that directory somewhere useful. I’ll pretend that you put it in your home directory and that your user is called jane, which means that the directory is now at /Users/jane/jdk-12.0.1.jdk.
* In a terminal, run export JAVA_HOME=/Users/jane/jdk-12.0.1.jdk (Of course, the path should be the correct path to jdk-12.0.1.jdk. If you put it in your home directory, it will be exactly what I called it here, but with your username in there instead of jane.)
* Now in that same terminal window, use cd to get to the jing-trang directory.
* Once you’re in the jing-trang directory, run ./ant and you should be in business. You can verify success by looking in the build directory inside your jing-trang directory. You should have jing.jar and trang.jar in there.

Validation for me uses the following two commands:

java -classpath $(JING_DIR)/build -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration -jar $(JING_DIR)/build/jing.jar $(MB)/schema/pretext.rng $(MAINFILE) > schema_errors.txt

xsltproc --xinclude $(MB)/schema/pretext-schematron.xsl $(MAINFILE) >> schema_errors.txt

Replace $(JING_DIR) with the path to your jing-trang directory. Replace $(MB) with your path to the mathbook directory. Replace $(MAINFILE) with your main PreTeXt file (the one that has the <pretext> tag in it).

The file schema_errors.txt will be written to the CURRENT DIRECTORY IN WHICH YOU EXECUTE THE COMMAND. I like to do this in a scratch or output directory (or put a more specific path than schema_errors.txt, and then it will be written exactly where you tell it to). You can then find the errors from both stages of validation in schema_errors.txt.

Hope this resolves your issues. If not, check back in, and I’ll see what other ideas I have.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To post to this group, send email to pretext...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/b8ee8846-460a-424b-ab15-c04fe1a49aa9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

— 
Mitch Keller

Karl-Dieter Crisman

unread,
Jun 14, 2019, 10:57:54 AM6/14/19
to PreTeXt support

Validation for me uses the following two commands:

java -classpath $(JING_DIR)/build -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration -jar $(JING_DIR)/build/jing.jar $(MB)/schema/pretext.rng $(MAINFILE) > schema_errors.txt

Yup.  Nicely outlined.
 

xsltproc --xinclude $(MB)/schema/pretext-schematron.xsl $(MAINFILE) >> schema_errors.txt


Wait, what?  Can someone explain this one to me?  I feel like I have been missing a whole step.  Are these not the same thing?


The file schema_errors.txt will be written to the CURRENT DIRECTORY IN WHICH YOU EXECUTE THE COMMAND. I like to do this in a scratch or output directory (or put a more specific path than schema_errors.txt, and then it will be written exactly where you tell it to). You can then find the errors from both stages of validation in schema_errors.txt.


Yes, this is a great workflow, and a REALLY important reminder about where the file shows up!  In particular, the worst place to put that is in your source directory.  As a hint, I create a .hgignore file which then has the output directories in it, as well as the specific name of the error file (which I put in the top directory, but output directory is fine).

Thanks for a comprehensive post, Mitch! 

Rob Beezer

unread,
Jun 14, 2019, 11:14:39 AM6/14/19
to pretext...@googlegroups.com

Rob Beezer

unread,
Jun 14, 2019, 4:02:00 PM6/14/19
to pretext...@googlegroups.com
On 6/13/19 7:55 AM, Mitch Keller wrote:
> I think this is my turn to help, since I suspect I’m one of the few hard-core
> validators who uses macOS :)

Thanks, Mitch. If you and Jane can post here with what works, and what doesn't,
then I can try to capture it all for the Author's Guide.

Rob

Karl-Dieter Crisman

unread,
Jun 15, 2019, 1:36:23 PM6/15/19
to PreTeXt support
Thanks, I had definitely forgotten about this in the past year. 

Jane Butterfield

unread,
Jul 22, 2019, 6:23:23 PM7/22/19
to PreTeXt support
Thank you, Mitch, for the detailed reply, and sorry it's taken me this long to follow those instructions -- I was away from my office machine for a few weeks.

I'm running macOS Mojave 10.14.5 as well.
  • Download JDK (current release is 12.0.2), unzip it until I have the directory called jdk-12.0.2.jdk, and put that directory into my home directory: no problems.
  • Run export JAVA_HOME=/Users/username/jdk-12.0.2.jdk (with username correct): no problem as far as I can tell.
  • Get into the jing-trang directory and run ./ant : Produces the error "You must set JAVA_HOME environment variable to point to the directory where your JDK is installed"
When I run echo ${JAVA_HOME} it replies with /Users/username/jdk-12.0.2.jdk, so it is set to point to the right place. Is it possible that JDK is still not installed, and there is more that needs to be done than just unzipping the download and putting that directory in my home directory? Just to see how broken it was, I tried setting JAVA_HOME to point at Users/username instead, and it didn't like that either but returned the same error and so was unilluminating.


On Thursday, June 13, 2019 at 7:56:00 AM UTC-7, Mitch Keller wrote:
I think this is my turn to help, since I suspect I’m one of the few hard-core validators who uses macOS :)

Here are my suggestions:

* Don’t worry about what which java returns. Mine (macOS 10.14.5) returns /usr/bin/java as well.
* That echo $(/usr/libexec/java_home) fails definitely indicates a problem. I think you’re right that you’ve not got the JDK installed correctly. I would suggest going to https://jdk.java.net/12/ and getting the open source JDK. Unfortunately, it comes without an installer. Fortunately, you really don’t need one. Unzip the file you download until you have a directory called jdk-12.0.1.jdk. Put that directory somewhere useful. I’ll pretend that you put it in your home directory and that your user is called jane, which means that the directory is now at /Users/jane/jdk-12.0.1.jdk.
* In a terminal, run export JAVA_HOME=/Users/jane/jdk-12.0.1.jdk (Of course, the path should be the correct path to jdk-12.0.1.jdk. If you put it in your home directory, it will be exactly what I called it here, but with your username in there instead of jane.)
* Now in that same terminal window, use cd to get to the jing-trang directory.
* Once you’re in the jing-trang directory, run ./ant and you should be in business. You can verify success by looking in the build directory inside your jing-trang directory. You should have jing.jar and trang.jar in there.

Validation for me uses the following two commands:

java -classpath $(JING_DIR)/build -Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludeParserConfiguration -jar $(JING_DIR)/build/jing.jar $(MB)/schema/pretext.rng $(MAINFILE) > schema_errors.txt

xsltproc --xinclude $(MB)/schema/pretext-schematron.xsl $(MAINFILE) >> schema_errors.txt

Replace $(JING_DIR) with the path to your jing-trang directory. Replace $(MB) with your path to the mathbook directory. Replace $(MAINFILE) with your main PreTeXt file (the one that has the <pretext> tag in it).

The file schema_errors.txt will be written to the CURRENT DIRECTORY IN WHICH YOU EXECUTE THE COMMAND. I like to do this in a scratch or output directory (or put a more specific path than schema_errors.txt, and then it will be written exactly where you tell it to). You can then find the errors from both stages of validation in schema_errors.txt.

Hope this resolves your issues. If not, check back in, and I’ll see what other ideas I have.
On Jun 12, 2019, at 7:48 PM, Jane Butterfield <jane.bu...@gmail.com> wrote:

I have been setting up my work computer for PreTeXt work, and all of the things I need to install are going just fin...other than jing.

The step I'm failing at is setting my `JAVA_HOME` environment, and I suspect it is failing because I have not actually obtained the JDK from Oracle that I thought I had. I wonder whether that is related to their new licence that started April this year, because I'm not convinced anything actually installed (I cannot find it). Sadly, I suspect it's just caused by me not installing things properly and not understanding terminal commands (both are things I know I limp through). Evidence: when I ask which java I get the same reply now as I did before attempting to obtain the JDK, namely /usr/bin/java 

I've read through and attempted to replicated the first few steps in the jing readme file, but they're listed explicitly only for linux and for windows and I don't have the command-line literacy to work out what to do for mac. As suggested in the pretext author guide subsection on jing-trang, I also tried the two suggested echo commands, both of which responded with No such file or directory.

I'm going to walk away from this for the day, and strongly suspect it's not the sort of thing someone can help me with without looking over my shoulder. It's probably fair to say that if I cannot work out how to get jing sorted then I shouldn't be reporting any errors that would require me to use it anyway! I certainly have everything set up well enough to author, which is my immediate goal.

--
You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pretext...@googlegroups.com.

— 
Mitch Keller

Mitch Keller

unread,
Jul 22, 2019, 6:33:10 PM7/22/19
to pretext...@googlegroups.com
I think I tested this with a different JDK copy and so didn’t realize a slight difference for the JAVA_HOME. Try:

export JAVA_HOME=/Users/username/jdk-12.0.2.jdk/Contents/Home

The ant script is looking for bin/java inside JAVA_HOME, so we need to drill a bit deeper into the JDK directory.

To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/b6ad72a0-33af-439e-93d6-9ae2023933b9%40googlegroups.com.

— 
Mitch Keller

Jane Butterfield

unread,
Jul 22, 2019, 7:24:18 PM7/22/19
to PreTeXt support
That makes perfect sense...and worked! Updated installation instructions so that there's a clean-and-correct copy in one place:
Download JDK (current release is 12.0.2). Unzip that download until you have the directory called jdk-12.0.2.jdk, and put that directory somewhere sensible. We will assume you put it in your home directory (/Users/username/jdk-12.0.2.jdk). 
Run export JAVA_HOME=/Users/username/jdk-12.0.2.jdk/Contents/Home (with path to jdk-12.0.2.jdk adjusted as appropriate).
In the same terminal window, cd into the jing-trang directory and run ./ant 



 

Rob Beezer

unread,
Jul 24, 2019, 7:19:14 PM7/24/19
to pretext...@googlegroups.com
Thanks, Jane, for sticking with this one, and Mitch, for the careful assist.
I'll remind Jane that the schema needs a bit of love right now, so don't panic,
and ask here if something does not seem right.

I've done my best to record these steps properly into a new appendix of the
Guide which can contain instructions on installing Mac-specific tools. (I'll
find it useful when working with authors on a Mac!) Corrections welcome, if
necessary. (I can make minor edits if a PR is too big a hurdle.)

https://pretextbook.org/doc/guide/html/mac-os-java.html

Rob

Mitch Keller

unread,
Jul 24, 2019, 7:39:51 PM7/24/19
to pretext...@googlegroups.com
Looks reasonable to me.
> --
> You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to pretext-suppo...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/pretext-support/e8addb68-9604-0c97-7fcb-befef5698aed%40ups.edu.


Mitch Keller
mi...@rellek.net

Rob Beezer

unread,
Jul 24, 2019, 7:59:44 PM7/24/19
to pretext...@googlegroups.com
Thanks for the review (since the last time I owned an Apple computer was about
23 years ago!).

Jane Butterfield

unread,
Jul 25, 2019, 1:24:12 PM7/25/19
to PreTeXt support
I've now set up two of my three Macs, helped my student get started on hers, and am about to set up my final one today. Keeping notes as we go of what confused us and where we found (or didn't find) the answers, and will send along any stumbling blocks I wasn't able to get over myself. Now up to a group of four, soon to be five, UVic folk who are giving PreTeXt a whirl on Mac, Windows 10, and probably on Linux -- considering that none of us really know what we are doing I'm sure we will do a great job finding those stumbling blocks!


On Wednesday, July 24, 2019 at 4:59:44 PM UTC-7, Rob Beezer wrote:
Thanks for the review (since the last time I owned an Apple computer was about
23 years ago!).

On 7/24/19 4:39 PM, Mitch Keller wrote:
> Looks reasonable to me.
>
>> On Jul 24, 2019, at 6:19 PM, Rob Beezer <bee...@ups.edu> wrote:
>>
>> Thanks, Jane, for sticking with this one, and Mitch, for the careful assist. I'll remind Jane that the schema needs a bit of love right now, so don't panic, and ask here if something does not seem right.
>>
>> I've done my best to record these steps properly into a new appendix of the Guide which can contain instructions on installing Mac-specific tools.  (I'll find it useful when working with authors on a Mac!)  Corrections welcome, if necessary.  (I can make minor edits if a PR is too big a hurdle.)
>>
>> https://pretextbook.org/doc/guide/html/mac-os-java.html
>>
>> Rob
>>
>> --
>> You received this message because you are subscribed to the Google Groups "PreTeXt support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to pretext...@googlegroups.com.

Rob Beezer

unread,
Jul 26, 2019, 2:31:49 AM7/26/19
to pretext...@googlegroups.com
Thanks, Jane. Looking forward to the reports!

On July 25, 2019 10:24:11 AM PDT, Jane Butterfield <jane.but...@gmail.com> wrote:
>I've now set up two of my three Macs, helped my student get started on
>hers, and am about to set up my final one today. Keeping notes as we go
>of
>what confused us and where we found (or didn't find) the answers, and
>will
>send along any stumbling blocks I wasn't able to get over myself. Now
>up to
>a group of four, soon to be five, UVic folk who are giving PreTeXt a
>whirl
>on Mac, Windows 10, and probably on Linux -- considering that none of
>us
>really know what we are doing I'm sure we will do a great job finding
>those
>stumbling blocks!
>
>
>On Wednesday, July 24, 2019 at 4:59:44 PM UTC-7, Rob Beezer wrote:
>>
>> Thanks for the review (since the last time I owned an Apple computer
>was
>> about
>> 23 years ago!).
>>
>> On 7/24/19 4:39 PM, Mitch Keller wrote:
>> > Looks reasonable to me.
>> >
>> >> On Jul 24, 2019, at 6:19 PM, Rob Beezer <bee...@ups.edu
><javascript:>>
>> wrote:
>> >>
>> >> Thanks, Jane, for sticking with this one, and Mitch, for the
>careful
>> assist. I'll remind Jane that the schema needs a bit of love right
>now, so
>> don't panic, and ask here if something does not seem right.
>> >>
>> >> I've done my best to record these steps properly into a new
>appendix of
>> the Guide which can contain instructions on installing Mac-specific
>tools.
>> (I'll find it useful when working with authors on a Mac!)
>Corrections
>> welcome, if necessary. (I can make minor edits if a PR is too big a
>> hurdle.)
>> >>
>> >> https://pretextbook.org/doc/guide/html/mac-os-java.html
>> >>
>> >> Rob
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>
>> Groups "PreTeXt support" group.
>> >> To unsubscribe from this group and stop receiving emails from it,
>send
>> an email to pretext...@googlegroups.com <javascript:>.
>> >> To view this discussion on the web visit
>>
>https://groups.google.com/d/msgid/pretext-support/e8addb68-9604-0c97-7fcb-befef5698aed%40ups.edu.
>
>>
>> >
>> > —
>> > Mitch Keller
>> > mi...@rellek.net <javascript:>
>> >
>>
Reply all
Reply to author
Forward
0 new messages