-
Notifications
You must be signed in to change notification settings - Fork 76
Using jar libraries
William Smith edited this page Nov 2, 2023
·
1 revision
You can install Processing libraries with APDE, see installing contributed libraries. But if you want to use a library that is just distributed as a .jar
, you can still use it without packaging it into a Processing library. Follow these steps:
- Using an external file manager, create a directory named
libs
in the sketch folder. - Copy the
.jar
intolibs
. We will assume it is namedsome-lib.jar
, but you can adjust the following steps based on the name of your library. - Create a
libs-dex
folder in the sketch folder, next tolibs
. - In APDE, open the library manager and select the "DX Dexter" tool from the menu.
- Enter the full path to
some-lib.jar
in the "Input File" field. - In "Output File", put the full path to
<sketch folder>/libs-dex/some-lib-dex.jar
. - Select "Dex" to convert the library to dex format.
- Use your library like normal.
Notes:
- You must add the library to each sketch that needs it, this is not global.
- Libraries must be converted to dex so they they can be used on Android. For contributed libraries the conversion is automatic, but automatic conversion for jar libraries is not currently supported.
- The original jar is still needed by the compiler, so you need both.