Is there any way to access custom java class by using pyjnius autoclass?

336 views
Skip to first unread message

QuanTech

unread,
Sep 15, 2018, 4:01:26 AM9/15/18
to Kivy users support
Hi~

Let's say I have a custom java file 'myjavaclass.java' located in an arbitrary directory '/path/to/myfile/src/org/myjavapackage'.
Is there any way by using pyjnius (for example, autoclass) to access the java class in this java file?
Like the way below:

from jnius import autoclass
MyPythonJavaClass = autoclass('org.myjavapackage.myjavaclass')

If it is feasible, what location should I put this java file so that autoclass can find it?
And what steps I should follow?

Thanks in advance!!


Will Tejeda

unread,
Sep 15, 2018, 2:27:19 PM9/15/18
to kivy-...@googlegroups.com
I’m wondering the same thing 

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To post to this group, send email to kivy-...@googlegroups.com.
Visit this group at https://groups.google.com/group/kivy-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/6fa1ca7e-f792-4c15-9f82-0d970dd172a6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

OptimusGREEN

unread,
Sep 18, 2018, 7:00:18 AM9/18/18
to Kivy users support
I'm pretty sure there is a dedicated bit in the builder spec for entering path to additional java files.

OptimusGREEN

unread,
Sep 18, 2018, 7:00:53 AM9/18/18
to Kivy users support
Buildozer not builder lol. Stupid corrective text on my phone.

QuanTech

unread,
Sep 18, 2018, 11:27:41 PM9/18/18
to Kivy users support
@OptimusGREEN

Thanks for the reply.
I know there's way to pack jar or java files in the apk with buildozer. But what I would like to achieve is to access the external java files.(let's say in sdcard or internal storage of android phone or tablet)
I got this need because I'm playing with an interesting android app called "Pydroid" on which I can run my kivy programs without spending a lot of time and effort building an apk. It's a convenient tool for my work.
It's sort of like kivy launcher, but much more flexible. (It's not advertisement. I have NO any relationship with its developer.)
The problem I'm facing is some android python package come with java files(for example an android python package for Bluetooth Low Energy functions).
I can build this kind of android python package into an apk with buildozer. And it works well. But when it comes to "Pydroid", the pyjnius autoclass can not find the java class because the java files are not in a location it can search for.

I hope this explains my needs and problems better.
Reply all
Reply to author
Forward
0 new messages