• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps How to use protege owl API in Android project

superemolee

Lurker
Jul 10, 2010
2
0
I have a practical seminar this semester, and I want to use ontology on Android application. I choose Protege owl ontology as a ontology API and this tool worked in normal Java project. But when I tried to import these jar files which for the owl ontology API in Android project, the project will fail and I haven't found any solutions in the Internet.
Some expert who can help me?
Thanks in advanced!
 
The Java language used on Android isn't exactly the same as "standard" Java.
You could take some source code and it would compile with the Sun JDK and with the Android Java compiler. But the compiled bytecodes you get would be different, and incompatible.
You can't take the results of the Sun Java compiler and run them on Android, and vice versa.

The jar files for the Owl ontology API will contain .class files probably compiled with the Sun JDK, and they won't be usable with Android.

If you can get hold of the source files, and re-compile them, then they should work.

There's a bit of extra background information here, if you're intested:

Dalvik - Google's tweaked, non-standard JVM for Android!!!! - O'Reilly ONJava Blog

Mark
 
Upvote 0
The existing jar files you have don't work, and will never work with android.
If you have the source files then you could compile then in a separate android project and then put the .dex files in a jar file, or you could add the source files to your existing android project.

Adding the source files to your existing project will probably be quicker and easier.

Mark

(Replying using phone, so keeping it short.)
 
Upvote 0
The Java language used on Android isn't exactly the same as "standard" Java.
You could take some source code and it would compile with the Sun JDK and with the Android Java compiler. But the compiled bytecodes you get would be different, and incompatible.
You can't take the results of the Sun Java compiler and run them on Android, and vice versa.

The jar files for the Owl ontology API will contain .class files probably compiled with the Sun JDK, and they won't be usable with Android.

If you can get hold of the source files, and re-compile them, then they should work.

There's a bit of extra background information here, if you're intested:

Dalvik - Google's tweaked, non-standard JVM for Android!!!! - O'Reilly ONJava Blog

Mark

Hi, Mark,
Thank for the response.
Do you mean if I can get the source files, and re-compile them using Android Java compiler, then the API(Jar files) will work?
And how to do that? Creating a new Android project and add the scr into the new project and then ?
Thanks in advanced!


This is simply not true... Both the Sun JVM, as well as the Dalvik JVM compile to the same byte code. Any jar file written in java will work with Android, provided they don't try to access any APIs that are not available in Android. the Android SDK uses a small subset of the standard Java APIs, and most common APIs are supported. More often than not, a Sun Java JAR file will work with Android. If the JAR file uses any UI stuff, however, it will NOT work with Android as neither the AWT or the Swingset are supported in Android (obviously).
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones