+ Start a Discussion
Daniel ThomsonDaniel Thomson 

unable to generate jar file from wsdl file

I am having the enterprise.wsdl file and i am trying to create a jar file using command 

 

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

 

but getting an error "Error: Unable to find compiler. Make sure that tools.jar is in your classpath:

java.lang.ClassNotFoundException: com/sun/tools/javac/Main.class"

 

can anyone help me..............

 

thank you.......................

bob_buzzardbob_buzzard

Do you have the JRE or the JDK installed on the machine that you are attempting this on?  As far as I recall, the JRE doesn't come with the compiler, is simply a runtime environment.

Daniel ThomsonDaniel Thomson

I have installed the jdk and all the java programms well functioning...........

i have created the jar file using jar commad of java..............

it gives me error at the time of jar file creation from wdlc file even though i am having tools.jar file in my library............

bob_buzzardbob_buzzard

As the error message suggests adding tools.jar to the classpath (i.e. the -classpath parameter), have you tried that?

magandrezmagandrez

Hi,

 

I'm getting as well the same error generating the .jar file as described above. I already placed Java (JDK) in my PATH, and also tried the -classpath parameter.

 

Do you have any hint on this?

 

Thanks.

Rahul JhaRahul Jha

Actually its not the problem of JDK.. Its just mistake of path provided by us.........
put all the files like  - your wsdl file, wsc-20.jar and tools.jar [from Jdk lib folder] into E directory of your computer then run the below command on your command prompt.........
"java -cp E:\tools.jar;E:\wsc-20.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar"

magandrezmagandrez

Hi Rahul Jah,

 

Thanks for the info, It worked out :)

 

Greetings,

 

mga

Dream_weaverDream_weaver

From Where you got that Tools .jar file ?

Can you provide the location ....

 

I am facing the same problem

dhnaiglesdhnaigles

I tried to follow all the instructions and I am still not able to generate the enterprise.jar file

1. I moved my force-wsc-29.0.0.jar, tools.jar, and enterprise.wsdl into c:\temp. 

2. I am using jdk 1.7.0_21 and have added the bin folder to my path. 

3. I ran this command from c:\temp: c:\temp>java -cp  force-wsc-29.0.0.jar;tools.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar

 

4.  I get this error:

******************

 

Exception in thread "main" java.lang.NoClassDefFoundError: org/stringtemplate/v4
/STGroupDir
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2451)
        at java.lang.Class.getMethod0(Class.java:2694)
        at java.lang.Class.getMethod(Class.java:1622)
        at sun.launcher.LauncherHelper.getMainMethod(LauncherHelper.java:494)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:486)

 

Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STGroupDir
        at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)

*******************************

 

 

Ankur SinghAnkur Singh

Actually when you create a WSDL file and save it as enterprise.wsdl in windows...it will be saved as enterprise.wsdl.xml

Put that file at a location as same location for wsc-22 (or whatever you using jar version of wsc)...then give this command on cmd
java -classpath c:\wsc-23.jar com.sforce.ws.tools.wsdlc C:\enterprise.wsdl.xml C:\enterprise.jar

I hope this will help you.

Thanks.

kanhu daskanhu das
force-wsc-36.1.1.jar;
rhino-1.7.7.jar;
ST-4.0.8.jar

has to be included in classpath for SOAP 36.1.1
sujay Paulsujay Paul
I had faced the same problem.After that I added tow more jar files i.e.
tools.jar;
antlr-runtime-3.5.2.jar
and it has worked.
The final command is:
D:\wsdl>java -classpath tools.jar;ST4-4.0.8.jar;force-wsc-37.0.3.jar;antlr-runtime-3.5.2.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar
Kevin Williams 35Kevin Williams 35
Found this great article: https://dimensionalforce.com/2015/11/22/compiling-enterprise-jar-from-salesforce-to-connect-using-enterprise-wsdl/ .

The Salesforce documentation is out of date as it doesn't include needing to download these additional jars.
sujay Paulsujay Paul
Actually in each 3 month they are creating a new version but all documents are not updating accordingly. So the user are affecting.
Rafael.Martins.SantosRafael.Martins.Santos
Hi,

I have the same problem, and I follow the step of Sujay Paul and work.

Only Thing I have to do is, copy the tools.jar from jdk/lib and paste in the same place the others jars, and it work.

So the path is: 
java -classpath C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\force-wsc-39.0.0.jar;C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\ST-4.0.8.jar;C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\rhino-1.7.7.1.jar;C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\antlr-runtime-3.2.jar;C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\tools.jar com.sforce.ws.tools.wsdlc C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\metadata.wsdl.xml C:\Users\rafael.santos\workspace\Metadata_Salesforce\WebContent\WEB-INF\lib\metadata.jar

If someone have the same problem than I, maybe this will help

Regards
Rafael
Ramn_rRamn_r
java -classpath force-wsc-29.0.0.jar;js.jar;ST-4.0.8.jar;tools.jar com.sforce.ws.tools.wsdlc   enterprise.wsdl   enterprise_stub.jar
This will work.Just put all the files mentioned here in the same folder
udaykumar kudaykumar k
hi ram, C:\Users\Uday19>java -classpath .\bulkload\tools.jar;.\bulkload\ST-4.0.8.jar;.\bulkload\force-wsc-40.0.0.jar com.sforce.ws.tools.wsdlc .\bulkload\partner.wsdl .\bulkload\partner.jar
[WSC][wsdlc.main:71]Generating Java files from schema ...
[WSC][wsdlc.main:71]Generated 660 java files.
[WSC][wsdlc.main:71]Compiling to target 1.6...
warning: [options] bootstrap class path not set in conjunction with -source 1.6
1 warning
[WSC][wsdlc.main:71]Compiled 670 java files.
[WSC][wsdlc.main:71]Generating jar file ... .\bulkload\partner.jar
[WSC][wsdlc.main:71]Generated jar file .\bulkload\partner.jar
facing above error
 
Douglas MolinaDouglas Molina
Hi!

I was facing this same problem, and I solved it doing the folowing steps (using Windows 7 x64):

1) Download and istall the Jdk V7u79 X64:
User-added image

2) Set some Environment Variables, in the SYSTEM VARIABLES section (NOT the User Variables) (Change the path to match with your local installations, if necessary):
JAVA_HOME
C:\Program Files\Java\jdk1.7.0_79

CLASSPATH
.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar;%JAVA_HOME%\lib\dt.jar;%JAVA_HOME%\lib\htmlconverter.jar;%JAVA_HOME%\jre\lib;%JAVA_HOME%\jre\lib\rt.jar

PATH
.;%JAVA_HOME%\bin

3) Download the WSDL file in your Org, and after downloading, look at the API version:
User-added image

4) Download the necessary Jars files...
 - wsc-40.0.0.jarhttp://mvnrepository.com/artifact/com.force.api/force-wsc
   Note: You'll download the exact same wsd-xx.xx.jar version, that you see in your WSDL API file, in this case 40.0.
 - js.jar (Rhino 1.7R4.zip): https://developer.mozilla.org/en-US/docs/Mozilla/Projects/Rhino/Download_Rhino
   Note: after download, I just unzip it, and used only the js.jar file.. and it worked.
 - ST-4.0.8.jar (String Template): http://www.stringtemplate.org/download.html

5) After download, put all this Jars and WSDL files together, in a same directory:
In my case, the WSDL was named "wsdl.jsp.xml", and the working dir was "C:\temp"
User-added image

6) Open the Windows prompt CMD and:
 - Open the working dir: cd C:\temp
 - Generate the final output Jar file, with the command line:

   java -classpath js.jar;ST-4.0.8.jar;wsc-40.0.0.jar com.sforce.ws.tools.wsdlc wsdl.jsp.xml enterprise.jar
   
The enterprise.jar file will be generted in that same folder.
User-added image

To test if it is working, I added all this Jars as External Jars in a Eclipse project (I really dont know if all of them are required to work..), and did the same login test class from this article:
https://developer.salesforce.com/docs/atlas.en-us.salesforce_developer_environment_tipsheet.meta/salesforce_developer_environment_tipsheet/salesforce_developer_environment_verify_wsdl.htm

The result:
User-added image

I hope it can help in some way.
Thanks.
Shrey_ShrmaShrey_Shrma
@Douglas Molina

Great answer. It contains all the tasks that one needs to do in order to create the jar files. According to me, this is the best answer.
Jana MadamJana Madam
Can we generate the jackson objects or jaxb object instead of soap objects?
Johann AbrahamJohann Abraham
Just tried the answer from @Douglas Molina with version 42.0.0 and on a Mac, it wasn't working because there was a missing jar file (antlr-runtime),  For me the following command worked (note that the classpath seperator on linux/OSX is a colon, for Windows just replace the ':' with ';'):
 
java -classpath rhino-1.7R4.jar:antlr-runtime-3.5.2.jar:ST4-4.0.8.jar:force-wsc-42.0.0.jar com.sforce.ws.tools.wsdlc salesforce-wsdl.xml enterprise.jar

I downloaded all the Jar files using Maven:
<dependency>
    <groupId>com.force.api</groupId>
    <artifactId>force-wsc</artifactId>
    <version>42.0.0</version>
</dependency>

<dependency>
    <groupId>org.antlr</groupId>
    <artifactId>antlr-runtime</artifactId>
    <version>3.5.2</version>
</dependency>

<dependency>
    <groupId>org.antlr</groupId>
    <artifactId>ST4</artifactId>
    <version>4.0.8</version>
</dependency>

<dependency>
    <groupId>org.mozilla</groupId>
    <artifactId>rhino</artifactId>
    <version>1.7R4</version>
</dependency>


 
Ramn_rRamn_r
add all the files to one folder and run this command
java -classpath force-wsc-29.0.0.jar;js.jar;ST-4.0.8.jar;tools.jar com.sforce.ws.tools.wsdlc   enterprise.wsdl   enterprise_stub.jar
Antony FerminusAntony Ferminus
Hello experts,
i am using the same command with all the information above.
my wsdl is v42.
java -classpath rhino-1.7.8.jar;antlr-runtime-3.5.2.jar;ST4-4.0.8.jar;force-wsc-42.0.0.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar
   
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/stringtemplate/v4/STGroupDir
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
        at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
        at java.lang.Class.getMethod0(Class.java:3018)
        at java.lang.Class.getMethod(Class.java:1784)
        at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.stringtemplate.v4.STGroupDir
        at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        ... 7 more

can sombody help with this?
Thanks in advance.

Regards,
Antony.
Antony FerminusAntony Ferminus
Hi Experts,
I last i made it with the code below.
I know may be some of the jar files can be omitted but
C:\tmp>java -cp antlr-runtime-3.5.2.jar;ST4-4.0.8.jar;force-wsc-42.0.0.jar;js-1.7R2.jar;stringtemplate-4.0.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar
Regards,
Antony.
Harikesh ThakareHarikesh Thakare
Hi Guys,

Getting the follwing error

Error: Unable to find compiler. Make sure that tools.jar is in your classpath: java.lang.ClassNotFoundException: com.sun.tools.javac.Main

after running the command

java -classpath js.jar;ST-4.0.8.jar;force-wsc-44.0.0.jar;tools.jar com.sforce.ws.tools.wsdlc Enterprise.wsdl enterprise.jar

can someone help

Regards,
Harikesh
Ramn_rRamn_r
HiCan u pls check  the steps I have shared earlier.Could be wsc  version.need to check  Sent from Yahoo Mail on Android
Antony FerminusAntony Ferminus
Hi,
Put all the files in a same folder c:/temp and run the command prompt
C:\tmp>java -cp antlr-runtime-3.5.2.jar;ST4-4.0.8.jar;force-wsc-42.0.0.jar;js-1.7R2.jar;stringtemplate-4.0.jar com.sforce.ws.tools.wsdlc enterprise.wsdl enterprise.jar

Enterprise JAR
It will work.
Subin009Subin009
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
Deepanshu Singh 4Deepanshu Singh 4
@Douglas Molina @Antony Ferminus
I did all the steps as mentioned by you , still getting the error...
command I am using is : java -classpath force-wsc-48.0.0.jar;rhino-1.7.12.jar;ST-4.3.jar;tools.jar com.sforce.ws.tools.wsdlc wsdl.xml enterprise.jar
See the Screenshot

User-added image