Kishore_2021
Kishore_2021

Reputation: 689

Unable to find class com.sun.security.auth.module.NTSystem.NTSystem on RDi 9.5 (64-bit) JRE 1.8

I am able to check the supplied user is system Administrator or not on windows machine with JRE 1.6 as

String groups[] = (new com.sun.security.auth.module.NTSystem()).getGroupIDs();
for (int i = 0; i < groups.length; i++)
{
    if ("S-1-5-32-544".equals(groups[i]))
    {
        return true;
    }
}

Ref: http://www.rgagnon.com/javadetails/java-check-if-current-user-is-admin-(windows).html

But this class NTSystem is not available on IBM RDi 9.5 (64-bit) JRE 1.8. Even the complete package is not available i.e.

com.sun.security.auth.*

Any idea, How to do the above task in RDi 9.5 (64-bit) JRE 1.8??

Upvotes: 1

Views: 2942

Answers (3)

Marcin P
Marcin P

Reputation: 430

Oracle said that JDK8 is changing sun.* classes

Some APIs in the sun.* packages have changed. These APIs are not intended for use by developers. Developers importing from sun.* packages do so at their own risk. For more details, see Why Developers Should Not Write Programs That Call 'sun' Packages. http://www.oracle.com/technetwork/java/faq-sun-packages-142232.html

src: http://www.oracle.com/technetwork/java/javase/8-compatibility-guide-2156366.html

Upvotes: 3

Kishore_2021
Kishore_2021

Reputation: 689

Got the perfect solution of my problem by using the JNA library.

http://www.rgagnon.com/javadetails/java-detect-if-current-user-is-admin-using-jna.html

Upvotes: 1

Premkumar Ramasamy
Premkumar Ramasamy

Reputation: 21

You should have the required JAR (rt.jar) in your JRE and it is part of JRE.

If it is available and still not able to view the classes, then you should set the the proper run time for IBM RDi.

Upvotes: 1

Related Questions