Search code examples
parsingxml-parsingxmlbeans

I am getting error when I am compiling xmlbeans : java io.ioexception cannot run the program "javac"


I am trying to run a sample of xmlBeans to compile a xsd and create a jar corresponding to that but I am getting this error again & again

java.io.Exception: Cannot run program "filelocation\javac": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start
    ............

It might be related to my "path" or "classpath" environment variable. Please suggest something.


Solution

  • I found the solution to the issue

    I was using a command

    scomp -out automobile-policy.jar automobile-policy.xsd

    but there was some problem with the javac location in the path variable i guess

    So I gave this command

    scomp -compiler "c:\Program Files\Java\jdk1.6\bin\javac.exe" -out automobile-policy.jar automobile-policy.xsd

    and it gave the desired automobile-policy.jar at the location.

    Please note that the location of the javac.exe might be different.