• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

calling other language dll in java

 
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
please tell me which language dll can be imported in java..? can dll be created in java itself..? please explain how to implement both the process..
 
author
Posts: 23919
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kunal vermaa wrote:please tell me which language dll can be imported in java..? can dll be created in java itself..? please explain how to implement both the process..



Here are instructions on how to call DLLs that are written in another language.

http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html

This DLL can technically be written in any languge (as they are DLLs), but the stubs for them are generated in C, so they should be written in C or C++. And no, Java can't create the DLLs. You will need a C/C++ compiler.

Henry
 
Rancher
Posts: 43027
76
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to JavaRanch.

You can't write DLLs in Java, but you can use the JNI API to access DLLs written in any language. It gets a bit more complicated for DLLs written in .Net languages, though. See http://faq.javaranch.com/java/JavaIntermediateFaq#callingCom for more detail.
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot for your replies..
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But can we make dll in Delphi ..? and import it in a java application..?
 
Marshal
Posts: 75716
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult a question for beginners. Moving.
 
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kunal vermaa wrote:But can we make dll in Delphi ..? and import it in a java application..?


If the Delphi-created DLL is a standard DLL, then I imagine that it can be used in a Java application, however, you still may (probably?) have to create a C or C++ app that uses the header file created by java and that has functions that wrap the functions in the DLL. The JNI tutorials will likely explain most of this to you.
 
Sheriff
Posts: 22650
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

kunal vermaa wrote:But can we make dll in Delphi ..? and import it in a java application..?


Yes. But I would suggest doing a search for JavaToDPR; this replaces the javah command to create Delphi declarations from your Java classes.
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Rob Prime wrote:Yes. But I would suggest doing a search for JavaToDPR; this replaces the javah command to create Delphi declarations from your Java classes.


Yikes. Please ignore what I posted above. I had not heard of JavaToDPR previously. Rob, thanks for setting me straight.

/Pete
 
Rob Spoor
Sheriff
Posts: 22650
126
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I first found it when looking for a way to use JNI with Delphi after I had been given a Delphi library and needed to wrap that in Java. Both JavaToDRP and JNI.pas (the Delphi replacement for jni.h) can be found here.

That said, I haven't been able to get the AWT part working yet. But then again, I haven't tried that hard
 
kunal vermaa
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks everybody..
 
A wop bop a lu bob a womp bam boom. Tutti frutti ad:
Free, earth friendly heat - from the CodeRanch trailboss
https://www.kickstarter.com/projects/paulwheaton/free-heat
reply
    Bookmark Topic Watch Topic
  • New Topic