This site requires JavaScript, please enable it in your browser!
Greenfoot back
VIad wrote ...


Help with external libraries

VIad VIad


Hi! I want to use an external library. I’ve addes it on the Edit->Preferences tab, however, when I export the game in the .jar format, it seems like the library does not work. Any advice?
rdFx rdFx


Hi, the external library is not exported. (Referring to your game as "game-jar" and to the external library as "external-jar") When you open your game-jar and view the content of it, you can actually see that your external library is missing. There are two ways (i know of) to fix this: 1. You could extract your external-jar and add the extracted folder(s) to your game-jar exported by Greenfoot. The command prompt to run your jar-file is the same as shown in Greenfoot when exporting it (because now it is actually contained within game-jar). 2. When running your game-jar via command prompt (the command is provided by greenfoot when exporting the jar), you can edit the classpath to your need. That means you provide the path to the needed external-jar via command prompt everytime you run your game-jar. To view and edit the content of any jar-file, you could use winrar, 7-zip or whatever.. (you propably have some program installed already)
You need to login to post a reply.