Exception in thread "main"
Added by Anonymous over 17 years ago
Legacy ID: #4225327 Legacy Poster: Wolfhart (wolfhart)
I bought a new MacBook today and am now trying to make Saxon8 work on the new machine as it worked on my old PC. I am trying the following command, which worked on the PC: java net.sf.saxon.Transform -o Temp/ ze/ tm.xsl (In subdirectory /ze there are a list of xml files which are to be transformed via tm.xsl and saved into subdirectory Temp/) I get the following error message: Exception in thread "main" java.lang.NoClassDefFoundError: net/sf/saxon/Transform Could someone tell me what the problem is? From browsing the internet, I got the impression that the problem lies with the "classpath", but since I don't know anything about Java, I am not sure what that means and how to fix the problem. How do I need to modify the command in order to make it work? Thanks in advance for your help, Wolfhart
Replies (5)
Please register to reply
RE: Exception in thread "main" - Added by Anonymous over 17 years ago
Legacy ID: #4225408 Legacy Poster: Michael Kay (mhkay)
Yes, you need to set the classpath to tell the Java system where to find the Saxon software. The simplest way is to set it on the command line, which you can do with: java -cp <path-to-saxon8.jar> net.sf.saxon.Transform ..... I expect that on your PC you had the classpath set up as an environment variable. You can do that on the Mac too, but I wouldn't know how, I'm afraid.
RE: Exception in thread "main" - Added by Anonymous over 17 years ago
Legacy ID: #4225778 Legacy Poster: Wolfhart (wolfhart)
Thanks, Michael. Now Saxon seems to start. But I have a different problem now: It does not find the stylesheet file tm.xsl ("Sylesheet file ... does not exist"); I tried it both with an absolute file path and a relative path, nothing works. (First I got the error message that it didnt find the source and the target directory. After I specified those by an absolute path, it seemed to find them and told me instead that the stylesheet file didnt exist. And in this case, specification by absolute path didnt help.) Can you help me out again? Thanks, Wolfhart
RE: Exception in thread "main" - Added by Anonymous over 17 years ago
Legacy ID: #4226092 Legacy Poster: Michael Kay (mhkay)
I'm sorry, but I can't tell what you were doing wrong unless you tell me very precisely what you were doing. When the system says a file doesn't exist it's usually right, and if you believe it is wrong then you will have to provide some convincing evidence.
RE: Exception in thread "main" - Added by Anonymous over 17 years ago
Legacy ID: #4226167 Legacy Poster: Wolfhart (wolfhart)
Thanks again for your reply, Michael. I came closer to the source of the problem, but I still dont know how to solve it. When I type the command java -cp /Applications/saxonb8-9j/saxon8.jar net.sf.saxon.Transform -o Temp/ ze/ tm.xsl on the command line and execute it, it works fine. However, if this command is part of a script (which is located in the same folder as tm.xsl, the same folder in which I am able to execute the above command) and I execute the script, I get: does not exist tm.xsl I dont understand why it makes a difference whether I type the command on the command line or have it executed as part of a script (which, again, is located in and executed from the same folder). Wolfhart
RE: Exception in thread "main" - Added by Anonymous over 17 years ago
Legacy ID: #4226215 Legacy Poster: Wolfhart (wolfhart)
I finally found the source of the problem: I edited my script with TextEdit (the standard Mac OS text editor) which uses Macintosh line endings, not Unix line endings. That's why the script wouldnt work and I got these strange error messages. Thanks again for your help, Michael. Wolfhart
Please register to reply