I'm getting the following error when trying to generate Java classes from an XSD schema using JAXB. I'm specifying a directory that I want them to be in but I am getting the following error when I try to run the command.
Command:
java -jar /home/Alison/Programs/jaxb-ri-2.2.6/lib/jaxb-xjc.jar xmlSchema.xjb -d com.q1labs.qa.xmlgenerator.model.xmlclasses xmlSchema.xsd
Error:
cowardly refuses to write to a non-existent directory "com.q1labs.qa.xmlgenerator.model.xmlclasses"
I found the following patch http://jira.codehaus.org/browse/MJAXB-2 but from the comments it seems that it no longer works with the current revision.
Is there any way I can specify to create the directory if it does not exist?
Is there any way I can specify to create the directory if it does not exist?
The simple answer is to create the directory before you run the application. In general, there is no way to get an application to create a directory for you if the application doesn't already have the capability to create directories.
FWIW, it is generally a bad idea for an application to create "missing" directories ... unless the user has indicated that that is what is required; e.g. via a command line option. The reason is that "missing" directories are usually due to the user mistyping a pathname, or due to the current directory being different to what the user thinks it is. In other words, the user usually wouldn't want the application to create the "missing" directories.
Manged to get this to work the way I wanted using the following command:
java -jar /home/Alison/Programs/jaxb-ri-2.2.6/lib/jaxb-xjc.jar -b xmlSchema.xjb -d src -p com.q1labs.qa.xmlgenerator.model.xmlclasses xmlSchema.xsd
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With