0

I am trying to "install" Saxon for xquery documents.

So I set the Classpath var with the saxon9he.jar as file name and tried in the cmd saxon9he but nothing happened. So I tried to execute a xquery file by:

java net.sf.saxon.Query

and i got:

C:\Users\Admin>java net.sf.saxon.Query
Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/saxon/Query
Caused by: java.lang.ClassNotFoundException: net.sf.saxon.Query
        at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
Could not find the main class: net.sf.saxon.Query.  Program will exit.

Whats wrong with my configuration?

--UPDATE 1--

C:\Users\Admin\Desktop\Studium\5tes Semster\Semistrukturierte Daten\3 Übung>jav
a -cp saxon9he.jar net.sf.saxon.Query
No query file name
Saxon-HE 9.2.1.2J from Saxonica
Usage: java net.sf.saxon.Query [options] query {param=value}...
Options:
  -backup:on|off        Save updated documents before overwriting
  -config:filename      Use configuration file
  -cr:classname         Use specified CollectionURIResolver class
  -dtd:on|off           Validate using DTD
  -expand:on|off        Expand defaults defined in schema/DTD
  -explain[:filename]   Display compiled expression tree
  -ext:[on|off]         Allow|Disallow external Java functions
...

The classpath var seems to be set right...

maximus
  • 11,264
  • 30
  • 93
  • 124

1 Answers1

1

The saxon documentation shows how to execute a XQuery from the command line:

java net.sf.saxon.Query [options] -q:queryfile [ params...]

Additionally, it states:

The XQuery processor may be invoked either from the operating system command line, or via an API from a user-written application. There is no graphical user interface provided.

And since it's java-based, it requires correct handling of the classpath. So,if you don't have much experience with both java and using a cli application, another XQuery may be easier to handle. Besides BaseX, there's Zorba; aquite complex solution would be eXist-db, a native XML database with XQuery processor and editor.

tohuwawohu
  • 13,268
  • 4
  • 42
  • 61