4

actually, i'm using java Language Detection to detect a text language, and i have this error:

Exception in thread "main" java.lang.IllegalAccessError: tried to access field com.cybozu.labs.langdetect.util.LangProfile.name from class com.cybozu.labs.langdetect.DetectorFactory

here is my code :

    public static String landDetect(String text) throws LangDetectException {
         String profileDirectory ="D:\\Spam Detection PFE 2016\\profiles";
        try {
            DetectorFactory.loadProfile(profileDirectory);
        } catch (LangDetectException ex) {
            Logger.getLogger(attribute_functions.class.getName()).log(Level.SEVERE, null, ex);
        }
    Detector detector = DetectorFactory.create();
        detector.append(text);
    return(detector.detect());

}
Jim Garrison
  • 85,615
  • 20
  • 155
  • 190
  • 1
    Maybe you should try [reporting this](https://github.com/shuyo/language-detection/issues) to the library instead seeking support from stackoverflow, since your code seems to be the same as [official sample](https://github.com/shuyo/language-detection/blob/wiki/ProjectHome.md). – Sheepy Mar 05 '17 at 00:03
  • Is the `name` field private in LangProfile? It appears to be trying to access that field but it cannot. – Carl Poole Mar 05 '17 at 00:25
  • 3
    I've found the solution, i had added two jar files versions ; instead of one. Thank youuu – Moncef Chaouche Mar 05 '17 at 13:19

0 Answers0