【问题标题】:importing javax packages in android? [duplicate]在android中导入javax包? [复制]
【发布时间】:2015-07-22 11:05:28
【问题描述】:

当我尝试在我的 android 应用程序中导入以下包时,我遇到了一些包(如 Javax)的问题!

Javax.naming.Naming.Exception; 
Javax.naming.directory.DirContext;
Javax.naming.directory.InitialDirContext;

 private DirContext connectLDAP()
    throws NamingException
 {
    Properties localProperties = new Properties();
    localProperties.setProperty("java.naming.factory.initial", LDAP_PROVIDER);
    localProperties.setProperty("java.naming.batchsize", "0");
    localProperties.setProperty("java.naming.provider.url", this.params.getLdapURL());
    localProperties.setProperty("java.naming.factory.url.pkgs", "com.sun.jndi.url");
    localProperties.setProperty("java.naming.referral", REFERRALS_IGNORE);
    localProperties.setProperty("java.naming.security.authentication", "none");
    return new InitialDirContext(localProperties);
}

帮我解决这个问题。

【问题讨论】:

    标签: java android security


    【解决方案1】:

    您尝试使用的类不属于the Android SDK。无论您要解决什么问题,您都需要找到其他解决方案。

    【讨论】:

    • 我是这么认为的,但这(zdnet.com/article/java-vs-android-apis)让我很困惑。而且我还看到很多人在 Android 上使用 javax.sound.. 我不明白如何以及为什么。
    • @JenixGuy:“让我感到困惑”——那是一篇 8 年前的文章,从那以后发生了一些变化(例如,我们现在只有一小部分 java.beans) .我不记得 javax.sound 曾经在 Android 中。
    • 啊哈!感谢您的澄清,现在我明白了!
    猜你喜欢
    • 1970-01-01
    • 2011-10-16
    • 2013-05-24
    • 1970-01-01
    • 2020-03-19
    • 1970-01-01
    • 1970-01-01
    • 2021-06-23
    • 1970-01-01
    相关资源
    最近更新 更多