## SectionJ.7Installing jing

The jing utility for schema validation can be installed in Windows. To install, first make sure Java is installed on your machine. You can either install the official Oracle JDK from https://www.oracle.com/technetwork/java/javase/downloads/index.html or, if you prefer an open license, https://jdk.java.net/12/. Download the .zip file, and extract to a folder such as C:\Java. (Avoid installing to the Program Files folder due to the space in the folder name.)

Next, follow the installation instructions in Section E.1, ignoring the BUILD FAILED message. You will almost certainly want to copy the file xercesImpl.jar from the lib. folder into build.

If you are using Git Bash for processing, you may want to set up a command shortcut to avoid the rather lengthy command given in Section E.1, especially if you have modularized source. Before proceeding, make sure that you have configured your Windows environment variables to include a path to Java. For example, if you installed JDK 12.0.1 in C:\Java you will want the path C:\Java\jdk-12.0.1\bin.

As suggested in Section E.1, you can set up a command in .bashrc. Git Bash on Windows requires a .bash-profile to load .bashrc. Open Git Bash and change to your user directory: cd /c/Users/your.name. Windows does not like file names beginning with a period, so if they do not already exist, you'll need to create them in Git Bash. Do touch .bash-profile and touch .bashrc to create the files. Use your favorite text editor to add the line

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi


to .bash-profile

You can then create the ptx-check command as in Section E.1. Absolute paths are recommended. Using the Git Bash syntax for Windows paths, your definition in .bashrc will look something like the following:

ptx-check() {
java\
-classpath /c/jing-trang/build\
-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=
org.apache.xerces.parsers.XIncludeParserConfiguration\
-jar /c/jing-trang/build/jing.jar\
/c/PreTeXt/mathbook/schema/pretext.rng "\$1"
}


The above assumes that jing-trang is installed at C:\jing-trang and that PreTeXt has been cloned at C:\PreTeXt\mathbook. Adjust your paths as needed. You can now run validation from Git Bash using

ptx-check ~/path/to/project/index.ptx > jing_report.txt


and the jing_report.txt file will be created in your working directory.