Ibrahim Bittar Posted May 21, 2014 Posted May 21, 2014 Hi, I'm absolutely new to Java and Groovy and I'm trying to figure things out. I have a JAR file, which I loaded using SMLoadJar and it returned no errors. If I use SMGetLoadedJars I get this: commons-codec-1.4.jar commons-ssl.jar commons-io-2.4.jar ws-timbrado-client.jar Now, I want to use the classes in ws-timbrado-client.jar and I'd like to know: Which classes are contained in the JAR file. What parameters they use. How to register those classes as modules so I can create a plugin with them. Here is the link to download the JAR file: http://solucionfactible.com/sfic/resources/files/librerias/timbrado/ws-timbrado-client.zip Thanks in advance. Ibrahim
Jim Randell Posted May 21, 2014 Posted May 21, 2014 Hi Ibrahim, I also have very little experience with Java/Groovy. BUT, after a great deal of Googling, trial and error, and patience (did I mention patience?), I was able to create a plugin successfully. In that process, I faced the same issue. Here is what I found: Which classes are contained in the JAR file. A .jar file is an archived and compressed folder, like a zip file. Most utilities which expand .zip files, will expand a .jar file into a folder I tested it on your .jar file, using Archive Utility.app on the mac What parameters they use. Any IDE will do, but for your (and my own) basic needs to drill down into the code of a class, I use a handy, cross platform, open source app called 'Java Decompiler': jd.benow.ca It allows you to explore the root folder of a decompressed jar, in a tree view, select the classes, and see a breakdown of the parameters and code base Caution: the app will drill down a jar file directly, but it has been my experience that it may not see all the classes in a jar. Best to decompress the jar into a folder, then use the app on the folder How to register those classes as modules so I can create a plugin with them. Just use the classes from the jar in your code, just be sure you load the jar. And this is what brings me here today, and brought me to your thread: jar dependencies. (I dont mean to go off topic, but you may face this issue next) Following the documentation as best I can, I can not get ScriptMaster to recognize jar files unless I have them in /Library/Java/Extensions (on osx). I have seen this issue mentioned in this forum while I was hunting down other issues, I hope somewhere in here it is thoroughly explained I will be looking for more info about that issue in this forum, but I might have to post the question myself. (but I will be watching this thread, if anyone wants to respond here.)
john renfrew Posted May 21, 2014 Posted May 21, 2014 The API documentation is also usually a good start for examples etc didn't take me long to find http://solucionfactible.com/sfic/capitulos/timbrado/librerias-jar-timbrado-api.jsp only I don't read Spanish Once you have loaded a jar file you need to tell the script to use the classes you want so something like: import com.solucionfactible.cfdi.ws.timbrado.xsd.* will let you use subclasses contained at that point There are certain Java classes you don't need to explicitly import as they are assumed by virtue of being part of Groovy itself Learning Groovy is worth doing by understanding how it works as a language and how its basic building blocks work start here: http://groovy.codehaus.org/For+those+new+to+both+Java+and+Groovy or see my previous post about a video... http://fmforums.com/forum/topic/91574-learning-groovy/
Recommended Posts
This topic is 3850 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now