Friday, October 21, 2016

Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2,

I was running the Ant build for a small webservice standalone program I was getting below error -

Buildfile: C:\workspace\WebserviceExample\build.xml
wsgen:

BUILD FAILED
C:\workspace\WebserviceExample\build.xml:5: Execute failed: java.io.IOException: Cannot run program "wsgen": CreateProcess error=2, The system cannot find the file specified

Total time: 413 milliseconds

This was my build.xml file-

<project default="wsgen">
 
 <target name="wsgen" >
   
  <exec executable="wsgen">
      
   <arg line="-cp ./bin -keep -s ./src -d ./bin com.myfirst.wsServer.SayHello"/>
      
  </exec>
      
 </target>
 
</project>


After providing the complete path for wsgen in exec tag it worked like a charm-

<project default="wsgen">
 
 <target name="wsgen" >
   
  <exec executable="C:\Program Files\Java\jdk1.7.0_79\bin\wsgen">
      
   <arg line="-cp ./bin -keep -s ./src -d ./bin com.myfirst.wsServer.SayHello"/>
      
  </exec>
      
 </target>
 
</project>

Hope it will help.





1 comment:

  1. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Java developer learn from Java EE Online Training from India. or learn thru Java EE Online Training from India . Nowadays Java has tons of job opportunities on various vertical industry.

    ReplyDelete