You need to sign in to do that
Don't have an account?
Daniel 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.......................
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.
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............
As the error message suggests adding tools.jar to the classpath (i.e. the -classpath parameter), have you tried that?
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.
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"
Hi Rahul Jah,
Thanks for the info, It worked out :)
Greetings,
mga
From Where you got that Tools .jar file ?
Can you provide the location ....
I am facing the same problem
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)
*******************************
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.
rhino-1.7.7.jar;
ST-4.0.8.jar
has to be included in classpath for SOAP 36.1.1
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
The Salesforce documentation is out of date as it doesn't include needing to download these additional jars.
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
This will work.Just put all the files mentioned here in the same folder
[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
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:
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):
3) Download the WSDL file in your Org, and after downloading, look at the API version:
4) Download the necessary Jars files...
- wsc-40.0.0.jar : http://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"
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.
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:
I hope it can help in some way.
Thanks.
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.
I downloaded all the Jar files using Maven:
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
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.
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.
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
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
It will work.
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
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
Hello, Can someone help me with this?
java -classpath tools.jar;force-wsc-54.0.0.jar;ST-4.3.1.jar;rhino-1.7.14.jar;antlr-runtime-3.5.2.jar com.sforce.ws.tools.wsdlc partner.wsdl sf-partner.jar
Solved this.
PATH variable was pointing to Oracle\Java\javapath causing Line 48 of Cmpiler.java from com.sforce.ws.codegen ToolProvider.getSystemJavaCompiler() to return null.
Removed that and added Java path C:\Program Files\Java\jdk1.8.0_181\bin solved it.
partner.jar created successfully.