Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DDL Files

Status
Not open for further replies.

smilyface

Programmer
Jun 3, 2003
12
0
0
GB
Well, i want yo know if so than how can you convert dll files into packages that can be used in java. Or is there any other way of using dll files by using classes.
 
I doubt you could convert as dll's contain precompiled native code. System.loadLibrary() works to load dll's, but I guess you would need to create a wrapper class if you want a class for it.
 
If you want to access f.ex. office programs, look for a java - com bridge.
For information on products look at :
For example "jawin" : The Java/Win32 integration project (Jawin) is a free, open source architecture for interoperation between Java and components exposed through Microsoft's Component Object Model (COM) or through Win32 Dynamic Link Libraries (DLLs).
 
what you need to do is to use JNI. First, create a java files that have the native method(to call your c or C++ methods). Check out java keyword native. Please note(as suggested above) that you have to have

static{
system.loadLibrary("yourdll");
}

to call your dll. After your java class has been successfully built, run javah command on the file, i.e.

c:\javah myjava


this will create a c/c++ header file. then you have to provide the cpp or c file for this c/c++ project. Then using your c/c++ workspace, build the dll and put it in a common place like windows\system32 so java can find the dll and load it up.

~za~
You can't bring back a dead thread!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top