Saxon on Windows 7
Added by Rob Flum almost 8 years ago
Hi, I have installed SaxonHE 9.6 for .Net on Windows 7 Enterprise SP1 64-bit, and also installed Java 8 JRE to use as the VM. I have .Net 4.6.1 installed. When I run saxon from the comand line, it says: "Unable to start the application. The Microsoft virtual machine cannot be found. Class not registered". The path to the Saxon executables is in my Path. I set the JAVA_HOME environment variable and added it to my Path, even though I already had the path to Java included. That made no difference. I have read the instructions for installing Saxon on the .Net platform, and I don't know where I have gone wrong. http://www.saxonica.com/html/documentation9.6/about/installationdotnet.html Any suggestions? thanks, Rob Flum
Replies (6)
Please register to reply
RE: Saxon on Windows 7 - Added by Michael Kay almost 8 years ago
This is all very strange and confusing.
You say you're running from the command line, but what exactly are you running and what is your command line?
You talk about running the .NET product and also about the Java platform and I'm left confused as to which you're using.
The message "The Microsoft virtual machine cannot be found" is something I haven't seen since the days of the old "instant saxon", which was a version of Saxon 6.3 packaged up to run with the Microsoft version of Java. Most people have probably forgotten that from about 1997 to 2001 Microsoft shipped their own version of Java, and Instant Saxon was designed to run on that platform. It's no longer obtainable so unless you are running a very ancient Windows platform "instant saxon" is no longer of any use to you.
RE: Saxon on Windows 7 - Added by Rob Flum almost 8 years ago
Hi Michael,
My intention was to use the .Net version of Saxon. I installed the JRE after reading the bit about Windows not having a VM anymore. If I don't need the JRE, is having it installed and setting JAVA_HOME somehow sending Saxon the message that I want to use it? I have not installed Instant Saxon.
I am using Saxon to modify WiX installer files to have more readable element ids. When I say I am running Saxon on the command line, I mean calling it from a batch file, running in the same folder as the .wxs files: Saxon -o Files_modded.wxs Mod_IDs.xsl Files.wxs
To make my question clearer, I should have asked it this way: what steps do I take to use SaxonHE on a Windows 7 machine? Are there some Saxon settings I need to set to tell it I want to use .Net?
thanks, Rob
RE: Saxon on Windows 7 - Added by Michael Kay almost 8 years ago
Unless you have a good reason for wanting to use the .NET version (specifically, if you want to integrate with other C# applications), then I would use the Java version of Saxon because it is significantly faster.
So download and install the appropriate version of Java from the Oracle web site, and then invoke your transformation using the java command line, for example
java -cp saxon9he.jar net.sf.saxon.Transform -s:source.xml -xsl:style.xsl -o:output.html
Even with the .NET version, the command line would be "Transform" rather than "Saxon". So I think that for some reason there is a version of the ancient "Instant Saxon" on your machine, and that is what your command line is picking up.
Using the -t option will give extra information as to what software you are running.
RE: Saxon on Windows 7 - Added by Rob Flum almost 8 years ago
Thank you! I'll uninstall the .Net version, install the Java version, and redo the batch file.
I'll be running the batch from inside a Visual Studio project, but I don't think that constitutes "integrating with other C# applications". Tell me if I'm wrong. If I do have Instant Saxon installed, it's hiding. It's not showing in Programs and Features, but SaxonHE 9.6.0.10 is. Also, the -t option isn't working because Saxon is bailing before it processes that option.
I expect it'll be smooth sailing from here on - I very much appreciate your help!
RE: Saxon on Windows 7 - Added by Rob Flum almost 8 years ago
I installed Java SDK 8u121 and the Java version of SaxonHE, and it works great!
Just one note: the -cp (-classpath) option to the java command needs to be the +full path+ to the Saxon jar file:
java -cp "C:\Program Files\Saxon\saxon9he.jar" net.sf.saxon.Transform -s:source.xml -xsl:style.xsl -o:output.html
if you installed Saxon to C:\Program Files\Saxon.
Thanks!
RE: Saxon on Windows 7 - Added by Michael Kay almost 8 years ago
Glad you got it working.
The entries in the classpath can be relative file names (relative to the current working directory) but using a full path name (or an environment variable) is often more convenience.
Please register to reply