i'm so sorry that i still don't know what to do, i execute the command
but [virt-sysprep: unknown option `--firstboot' ] execption happens,
could you show me the detail? Thanks!
and i have another question:
now , i use ssh2 api to execute the remote virt-XXX(virt-win-reg virt-sysprep ......) command,
is there java api like guestfs?

From: Richard W.M. Jones
Date: 2012-08-29 16:46
To: 周涛
CC: libguestfs
Subject: Re: Re: libguestfs! help!
On Wed, Aug 29, 2012 at 11:34:51AM +0800, 周涛 wrote:
> i try it in my environment,it allways throws the exception :
> com.redhat.et.libguestfs.LibGuestFSException: sh: /bin/sh: Exec format error
> then i try the following programs, "Exec format error" still happens:
> String cmd1 = "chkconfig --add tomcat";
> g.sh(cmd1);
> String cmd2 = "/sbin/chkconfig --add tomcat";
> g.sh(cmd2);
> String[] cmd = new String[] {"/sbin/chkconfig", "--list"};
> g.command(cmd);
> but i can execute the command in system, could show me the reason, Thanks!
Well it's something to do with the guest being either a much older or
much newer version of Linux than the host, or perhaps it's a different
architecture (32 vs 64 bits?), or not even Linux at all.
The way to solve this is to use a firstboot script:
> From: Richard W.M. Jones
> Date: 2012-08-28 00:39
> To: libguestfs@redhat.com
> However to run the command it may be better to run the command using a
> "firstboot" script.  See:
>   http://libguestfs.org/guestfs.3.html#running-commands
>   http://libguestfs.org/virt-sysprep.1.html#firstboot-
> (Note that the ability to use firstboot scripts was only added very
> recently to virt-sysprep).
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine.  Supports Linux and Windows.

Confidentiality Notice: The information contained in this e-mail and any accompanying attachment(s)
is intended only for the use of the intended recipient and may be confidential and/or privileged of
Neusoft Corporation, its subsidiaries and/or its affiliates. If any reader of this communication is
not the intended recipient, unauthorized use, forwarding, printing,  storing, disclosure or copying
is strictly prohibited, and may be unlawful.If you have received this communication in error,please
immediately notify the sender by return e-mail, and delete the original message and all copies from
your system. Thank you.