docbook-apps

  • 1.  CLASSPATH and Saxon

    Posted 11-09-2010 05:54
    Hi All,



    I have tried to set CLASSPATH for saxon as per mentioned in the "DocBook
    XSL: The Complete Guide Fourth Edition" Page 53 "To update your CLASSPATH on
    Windows, do the following:" in my Windows XP Professional OS.



    In my Environmental variable for CLASSPATH has been as follows:



    .;C:\Program
    Files\Java\jre6\lib\ext\QTJava.zip;C:\saxonhe9-2-1-5j\saxon9he.jar;C:\docboo
    k-xsl-1.76.1-RC2\extensions\saxon65.jar;C:\xml-commons-resolver-1.2\resolver
    .jar;L:/catalog.xml;C:\fop-1.0\;



    But when I open command prompt and typed the error message appears as below:



    Microsoft Windows XP [Version 5.1.2600]

    (C) Copyright 1985-2001 Microsoft Corp.



    C:\Documents and Settings\007.TECHSETINDIA.000>java com.icl.saxon.StyleSheet
    -t

    Exception in thread "main" java.lang.NoClassDefFoundError:
    com/icl/saxon/StyleSheet

    Caused by: java.lang.ClassNotFoundException: com.icl.saxon.StyleSheet

    at java.net.URLClassLoader$1.run(Unknown Source)

    at java.security.AccessController.doPrivileged(Native Method)

    at java.net.URLClassLoader.findClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)

    at java.lang.ClassLoader.loadClass(Unknown Source)

    Could not find the main class: com.icl.saxon.StyleSheet. Program will exit.





    Can anybody help me to solve this problem?



    Thanks,

    Srikrishnan




  • 2.  RE: [docbook-apps] CLASSPATH and Saxon

    Posted 11-09-2010 09:12
    Srikrishnan,

    Sometimes Windows doesn't update path values entered by GUI until it will be restarted. Try enter 'SET CLASSPATH' in your command line. Suggest there are "Environment variable CLASSPATH not defined" message will appears (if you created CLASSPATH) or CLASSPATH doesn't contains needed jars (if you edited CLASSPATH). If so - try to restart Windows.

    --
    Best regards,
    Eduard Tibet





  • 3.  Re: [docbook-apps] CLASSPATH and Saxon

    Posted 11-09-2010 14:36
    FYI - you usually just need to close out the command lime window and start that again. That is when it starts another session and reloads the environmental variables (i.e CLASSPATH, PATH, etc).



    In a message dated 11/09/10 01:12:51 Pacific Standard Time, eduard.tibet@i-free.com writes:
    Srikrishnan,

    Sometimes Windows doesn't update path values entered by GUI until it will be restarted. Try enter 'SET CLASSPATH' in your command line. Suggest there are "Environment variable CLASSPATH not defined" message will appears (if you created CLASSPATH) or CLASSPATH doesn't contains needed jars (if you edited CLASSPATH). If so - try to restart Windows.

    --
    Best regards,
    Eduard Tibet





  • 4.  Re: [docbook-apps] CLASSPATH and Saxon

    Posted 11-09-2010 09:52
    On Tue, November 9, 2010 5:53 am, SriKrishnan wrote:
    ...
    > In my Environmental variable for CLASSPATH has been as follows:
    >
    > .;C:\Program
    > Files\Java\jre6\lib\ext\QTJava.zip;C:\saxonhe9-2-1-5j\saxon9he.jar;C:\docboo
    > k-xsl-1.76.1-RC2\extensions\saxon65.jar;C:\xml-commons-resolver-1.2\resolver
    > .jar;L:/catalog.xml;C:\fop-1.0\;
    >
    > But when I open command prompt and typed the error message appears as
    > below:
    ...
    >
    > C:\Documents and Settings\007.TECHSETINDIA.000>java
    > com.icl.saxon.StyleSheet
    > -t
    >
    > Exception in thread "main" java.lang.NoClassDefFoundError:
    > com/icl/saxon/StyleSheet

    You have a mismatch between the Saxon version that you say you want to use
    and the Saxon version that you are using.

    Saxon 9 uses package names that begin 'net.sf.saxon' and, AFAICT, doesn't
    have a 'StyleSheet' class. In fact, Saxon package names haven't begun
    with 'com.icl.saxon' for many years.

    It may be that you want the old Saxon 6.5 version, not the newer Saxon 9.

    Regards,


    Tony Graham Tony.Graham@MenteithConsulting.com
    Director W3C XSL FO SG Invited Expert
    Menteith Consulting Ltd XML Guild member
    XML, XSL and XSLT consulting, programming and training
    Registered Office: 13 Kelly's Bay Beach, Skerries, Co. Dublin, Ireland
    Registered in Ireland - No. 428599 http://www.menteithconsulting.com
    -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
    xmlroff XSL Formatter http://xmlroff.org
    xslide Emacs mode http://www.menteith.com/wiki/xslide
    Unicode: A Primer urn:isbn:0-7645-4625-2




  • 5.  RE: [docbook-apps] CLASSPATH and Saxon

    Posted 11-09-2010 10:00
    Hi Tony,

    Thanks for your suggestion.

    Yes I came to knew that from "Saxonica" website. I think "DocBook XSL: The
    Complete Guide Fourth Edition" has outdated information in this regard.

    But still sample syntaxes mentioned in the
    "http://www.saxonica.com/documentation/about/gettingstarted/gettingstarteddo
    tnet.xml" are not working properly in my case:

    java -cp saxon9he.jar net.sf.saxon.Transform -t -s:samples/data/books.xml
    -xsl:samples/styles/books.xsl -o:c:/temp.html

    The above syntax not working, whereas if I modified something like below it
    works:

    java net.sf.saxon.Transform -t -s:C:/saxonhe9-2-1-5j/samples/data/books.xml
    -xsl:C:/saxonhe9-2-1-5j/samples/styles/books.xsl -o:c:/temp.html

    Original first syntax gives error as follows:

    C:\Documents and Settings\007.TECHSETINDIA.000>java -cp saxon9he.jar
    net.sf.saxon.Transform -t -s:samples/data/books.xml
    -xsl:samples/styles/books.xsl -o:c:/temp.html
    Exception in thread "main" java.lang.NoClassDefFoundError:
    net/sf/saxon/Transform
    Caused by: java.lang.ClassNotFoundException: net.sf.saxon.Transform
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    Could not find the main class: net.sf.saxon.Transform. Program will exit.

    Whereas modified second syntax works correctly. Can anyone help me why "-cp"
    is not working as expected in "windows XP"?

    Thanks,
    Srikrishnan




  • 6.  Re: [docbook-apps] CLASSPATH and Saxon

    Posted 11-09-2010 11:39
    SriKrishnan wrote:

    > Whereas modified second syntax works correctly. Can anyone help me why "-cp"
    > is not working as expected in "windows XP"?

    -cp disables classes available through CLASSPATH environment variable.
    You should specify full path to your JAR file in -cp (unless it is in
    the current directory), otherwise JVM will not find it.

    --
    ------------------------------------------------------------------
    Jirka Kosek e-mail: jirka@kosek.cz http://xmlguru.cz
    ------------------------------------------------------------------
    Professional XML consulting and training services
    DocBook customization, custom XSLT/XSL-FO document processing
    ------------------------------------------------------------------
    OASIS DocBook TC member, W3C Invited Expert, ISO JTC1/SC34 member
    ------------------------------------------------------------------