0

So I'm trying to come up with an Android app that can read a text file of Japanese text, and provide insightful information to the reader about the vocab and grammar being utilized.

To do this I need a Japanese morphological analyzer to parse the non-spaced text into individual words.

I found a few very useful libraries from Apache :

Lucene-Analyzers-Kuromoji (Japanese morphological Analyzer)

Lucene-Analyzers-Common (Dependant)

Lucene-Core (Dependant)

Testing these libraries in an empty Java project, I found these libraries to be very useful and reliable for breaking down Japanese text. Sadly, when I tried using them in my app, my project wouldn't compile, and I realized that my libraries were built on Java 7U40.

http://grepcode.com/static/data/html/repo1.maven.org$maven2/org.apache.lucene/lucene-analyzers-common/5.0.0/visualization.svg

Looking through a few posts on Stack Overflow, the consensus seemed to be that the only solution is to find a library written in Java 6 or older.

Searching through the Maven repository, I found versions of the same libraries tracing back all the way to 2012.

Checking the dependencies on each one, I found the latest version written with java 6 was just published in April of 2014.

http://grepcode.com/static/data/html/repo1.maven.org$maven2/org.apache.lucene/lucene-analyzers-common/4.7.2/visualization.svg

Is this a good method for getting around Android's jdk 6 limitation? Using outdated software built on old versions of Java seems like a rather temporary solution, and I don't think this method will hold for very long.

As more libraries are being written in more modern versions of Java, this problem should only get worse.

I haven't personally heard anything about Android switching to java 7 or 8 (I'm new to Android), does anyone know if there's a more reliable way of approaching this problem?

Sox Keep You Warm
  • 691
  • 1
  • 9
  • 14

2 Answers2

1

Is this a good method for getting around Android's jdk 6 limitation?

For some definition of "good", yes, if it runs.

As more libraries are being written in more modern versions of Java, this problem should only get worse.

Only for developers that are taking projects that focus on traditional Java environments and try using them on Android. Note that Lucene was not designed to be used on mobile devices; historically, their focus has been on server-side Java. If stuff from Lucene happens to work on Android, that's great and all, but the Lucene project may or may not have Android compatibility high on their list of concerns.

Android supports development in newer versions of Java, in terms of syntax. However, Android's class library is not the same as Java's class library for Java SE, Java EE, etc. That has nothing intrinsically to do with Java version, though since Android was released when Java 6 was the current version of Java, its class library most closely resembles Java SE from Java 6.

Somebody with the itch to scratch could conceivably create a variant of these libraries that match their current feature set but stick to classes that exist in the Android SDK. Or, somebody with the itch to scratch could more directly implement an Android-friendly Japanese morphological analyzer (and, for all I know, somebody has, as I have not gone looking for one).

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
0

Android does support jdk 7 according to this post. You need to change the language level for your project (and probably update android sdk since it's recent)

Community
  • 1
  • 1
flafoux
  • 2,080
  • 1
  • 12
  • 13
  • 1
    Does it? I just generated a lint result and was running into a problem with java.nio.file checking it out on the java api, it was just added in java 7. From the googling i did it sounded like the Android only supports the language features that were added in java 7 like diamonds, multi-catch (referenced from this post) http://stackoverflow.com/questions/20480090/does-android-support-jdk-6-or-7 – Sox Keep You Warm May 11 '15 at 18:39