+ Start a Discussion

Error could not find or load main class com.sforce.ws.tools.wsdl

After running 


java -classpath wsc-22.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar


I get the error:


Error could not find or load main class com.sforce.ws.tools.wsdl


I downloaded wsc-22.jar and put it in my classpath what am I missing?

Best Answer chosen by Admin (Salesforce Developers) 

I figured it out. I removed -classpath wsc-22.jar and it worked correctly.

All Answers


I figured it out. I removed -classpath wsc-22.jar and it worked correctly.

This was selected as the best answer
Jenni NeeJenni Nee

Hi there,


I am looking for someone who can help me out on web services and integrations. I have good experience in apex coding, and now I want to gain knowledge on web services and different ways to connect with outside the salesforce platform database. Can you please provide some information on these areas?


I would like to know about

  1. What kind of need forces us to use web services?
  2. How to start with web services.
  3. What are the areas that I should consider when working with web services?
  4. Is that mandatory to have knowledge on Java/.NET to work with web services, Integrations.
  5. Whatever the document I have seen, is a long process to test the functionality and implement the logic as well.
  6. Do we have any free source/environment to create and test our implemented logic?

Please do send something it is very important for me.





I have a different and more general solution. The -classpath should be followed by a path. So this works for me:

java -classpath ./wsc-23.jar etc.....

The ./ turns it into a path to the class file.

Just removing "-classpath wsc-23.jar" did not work for me - it couldn't find main in com.sforce.ws.tools.


I know this is a late reply but try this

Copy wsc-23.jar and your wsdl to C drive without making any folder.

open cmd and run this command

java -classpath c:\wsc-23.jar com.sforce.ws.tools.wsdlc C:\enterprise.wsdl C:\enterprise.jar

I am having this same issue. I ran the command that Manjit.Singh suggested & I am getting the Exception in thread "main" java.lang.NoClassDefFoundError.  Any other suggestions?

I just ran it again but used the wsc-22.jar file. Now I get the javac: target release 1.6 conflicts with default source release 1.7. I keep going around & around & nothing seems to work.
Vinodh MKVinodh MK
Hey joy1.3948205997477302E12,
    The issue you are facing is due to the conflict between your JDK version and JRE version. Try to use same JDK and JRE version. for eg : 1.7.1 for both JDK and JRE and you should be good to go..
Chandrashekhar Dautpure 9Chandrashekhar Dautpure 9
Joy and Vinod, to solve the problem add compatibility argument in java command.
Suppose you have 2 version JDK, you can let command know which version to use.
Roh SenRoh Sen
Still i am facing some issue
Roh SenRoh Sen
Below is the temp directory containing all the jars, and command line shows following error...

Please provide some suggestions..

.Directory with all the required libraries

still getting this error...
Roh SenRoh Sen
Thanks, its working..
The mistake was in the wcs jar name.
Jeyapriya JJeyapriya J
I am facing the same issue, I tired all the above steps but facing the issue 

Error: Could not find or load main class com.sforce.ws.tools.wsdlc

Could anyone please help.