问题
I'm having a problem with the java library sikuli. First I downloaded the sikuli setup jar and executed it. It created sikuli-java.jar and a libs folder (under c:/documents/sikuli). After that I created a project in eclipse, added the jar to the build path and wrote the code. The code worked when I ran it in eclipse. After that I created a runnable jar from it. I ran the runnable jar. It closed when it hit the sikuli code.
I want to export the app as a runnable jar and deploy it, without the users need to install sikuli. Is this even possible?
Also: https://github.com/RaiMan/SikuliX-2014/wiki/Usage-in-Java-programming
take care, that sikulixapi.jar is in the Java classpath of your project
I don't even have a file called sikulixapi.jar.
=======================================
Maybe a quick note, I've created the sikuli-java.jar with option 4 and 6.
edit: Anyone? The application works fine in eclipse but when I export it as runnable jar and run it, as soon as it hits the sikuli stuff it closes. No catch block triggered, although I've surrounded the code with catch(Exception ex). I've configured eclipse like this: https://stackoverflow.com/a/10354759/2815780
回答1:
This is RaiMan from SikuliX (http://sikulix.com)
-- 1. You currently are using 1.0.1. I recommend to switch to version1 1.1.0, since this installs smoother especially on Windows (no path entry or anything else needed anymore). Since you want to deploy your app to systems not having SikuliX installed, this would make it easier.
-- 2. If you want to run your app on systems not having SikuliX installed, you have to pack a sikulixapi.jar (created with setup for the target system) into your application jar (make a so called fat jar or uber jar) or allow people to download a ready made sikulixapi.jar from somewhere and take care in your application, that sikulixapi.jar is on class path, when your app runs. What makes sense in your case, depends on how you want to publish your app.
-- 3. you say: The application works fine in eclipse but when I export it as runnable jar… Inside Eclipse it takes car, that dependent stuff is on class path. The jar produced in the workspace though is "naked" and need a class path at run time. There is an option, to copy the dependent jar to a lib folder in the workspace. If you do that, your jar will work (though I do not recommend this: sikulix jars should not be moved around but only referenced somehow)
-- 4. you say: No catch block triggered, although I've surrounded the code with catch(Exception ex). If you run your jar from command line saying:
java -jar myapp.jar
it should crash with some unmatched exception (most probably "class not found")
As you already did, you might contact me directly with reference to this post here.
来源:https://stackoverflow.com/questions/27880151/exporting-an-app-with-sikuli