+ Start a Discussion

Help with wsc compilation?

I keep getting this error when compiling my wsdl with wsc?


Java version:

java version "1.6.0_22"
Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
Java HotSpot(TM) 64-Bit Server VM (build 17.1-b03, mixed mode)


[WSC][wsdlc.<init>:79]Generating Java files from schema ...
[WSC][wsdlc.<init>:79]Generated 363 java files.
java.io.FileNotFoundException: C:\Program Files\Java\jre6\lib\tools.jar (The sys
tem cannot find the file specified)
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at com.sforce.ws.tools.wsdlc$ToolsJarClassLoader.<init>(wsdlc.java:425)
        at com.sforce.ws.tools.wsdlc$Compiler.findCompilerInToolsJar(wsdlc.java:
        at com.sforce.ws.tools.wsdlc$Compiler.<init>(wsdlc.java:334)
        at com.sforce.ws.tools.wsdlc.compileTypes(wsdlc.java:261)
        at com.sforce.ws.tools.wsdlc.<init>(wsdlc.java:88)
        at com.sforce.ws.tools.wsdlc.run(wsdlc.java:312)
        at com.sforce.ws.tools.wsdlc.main(wsdlc.java:303)
Error: Unable to find compiler. Make sure that tools.jar is in your classpath: j
ava.io.FileNotFoundException: C:\Program Files\Java\jre6\lib\tools.jar (The syst
em cannot find the file specified)


It looks like you're trying to build it just using a JRE (just runtime), you need a java SDK installing.


I'm trying to compile jar using WSC so I downloaded it here http://code.google.com/p/sfdc-wsc/downloads/detail?name=wsc-22-jdk-1.7.jar&can=2&q= and I generated  enterprise.xml form my org. After that I do this in command line

java -classpath wsc-22-jdk-1.7.jar com.sforce.ws.tools.wsdlc enterprise.xml enterprise.jar. And then I'm getting an error: Could not find or load main class com.sforce.ws.tools.wsdlc. 


Please help me to find out what the issue is.



Yomesh PanchalYomesh Panchal

First set the classpath in command prompt like following or in Environment variable 

set CLASSPATH=.;C:\java\jdk1.7.0_09\jre\lib\rt.jar;C:\SalesForce\WSDL\wsc-22-jdk-1.7.jar;


Then run following command 


java -DcompileTarget=1.7 com.sforce.ws.tools.wsdlc pathToWsdl\WsdlFilename pathToOutputJar\OutputJarFilename

Installed latest jdk and used the below command as below and it worked..
java -cp antlr-runtime-3.5.2.jar;ST-4.1.jar;wsc.jar;js-1.7R1.jar;stringtemplate-3.2.1.jar com.sforce.ws.tools.wsdlc partnerwsdl.wsdl partner.jar