Runnable JAR file

Asked by Reinaldo Burgos

How can I create a Runnable JAR file using eclipse?

I created a Sikuli project in eclipse and I have run it and this working.

Now I have attempted a lot time to create a runnable JAR file using eclipse, when I run the jar file from command prompt it claim about the image path?
The image path is the same as use in eclipse environment..

Sorry for my bad English but I need to know some solution for this..

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

I guess in your code you are using something like "images/some-image.png" and the images folder is in your Eclipse project folder.

Running your stuff inside Eclipse works fine, because the working folder is your project folder.

If you try to run the jar from command line, then usually your current working folder is not the project folder and hence the images cannot be found.

You have to somehow define, where either relative to your working folder or with an absolute path your images are.

The imagepath feature in class ImageLocator might be helpful too.

If my guessing is not right come back with more details on how you do it.

Revision history for this message
Aravind (a4aravind) said :
#2

In the eclipse project you will have a particular folder structure.

If suppose you have something like this:
MyEclipsePjct
->src
   ->MySikuli.sikuli

and you might be running from the commandline this 'MySikuli.sikuli' jar

then, you can create a separate folder under this sikuli pjct, say 'Library.sikuli'

MyEclipsePjct
 ->src
   ->MySikuli.sikuli
       ->Library.sikuli ( where you could keep all your images)
       ->your_main_script

and add this piece of code in your script(based on the sample eclipse folder above)

myImagePath = "path_upto_your_eclipse_workspace\\MyEclipsePjct\\src\\MySikuli.sikuli\\Library.sikuli"
addImagePath(myImagePath)

Can you help with this problem?

Provide an answer of your own, or ask Reinaldo Burgos for more information if necessary.

To post a message you must log in.