0

I have method/function to get the drive info using Visual C++ of Microsoft Visual Studio. The method only return the type of drive. But it is become difficult when I'm trying to get more information about the drive. This difficulty gets resolved by Java's existing package. Furthermore, few codes are also there which is easy to handle with C platform. So, I'm thinking, if there is any efficient process which can include a native C code with in Java so that the functionality of both the language can be used in meaningful way.

Can anyone help me in this regard?

2
  • 1
    Please edit your question to include the current C code you're working with. I may be able to convert that to JNA for you. Commented Aug 24, 2013 at 16:28
  • The code Return drive type: int main(){ unsigned type; char driveLetter[] = "x:\\"; printf("Drive Letter: "); fflush(stdin); driveLetter[0] = getchar(); type = GetDriveType(driveLetter); /* switch-case to show drive type */ return 0; } Commented Aug 24, 2013 at 17:17

1 Answer 1

1

Java Native Access (JNA) is a way you can access C libraries from Java code. Its advantage over Java Native Interface (JNI) is that the library glue code is written in Java, not C, making it more maintainable.

(I've used JNA a lot at work. If I get permission from work, I may be able to post the JNA stuff I've written, as examples for you to work with.)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.