How to use DLL files in java?
hi!
i am working on hardware based java programming. the drivers which i have are in dll format. the manufacturers dont have a java based driver api's for the hardware. i want to invoke the dll file using a bridge between windows invironment and jvm invironment. more over i am not preferring to use native interface interface and c program to tackle this problem.
is there a way out?
Is it a COM dll? You could use JACOB. If it's not COM, there's also JNA which as I understand it, is simpler than JNI, although I've never used it
Edited by: georgemc on Aug 22, 2008 11:05 AM links not working at moment for some reason
Edited by: georgemc on Aug 22, 2008 11:10 AM
Similar Messages
-
hi,
i have a dll file thats present some function. i called DLL file from java . i got the some errors such as
Exception in thread "main" java.lang.UnsatisfiedLinkError: Error looking up function 'USBIsConnected': The specified procedure could not be found.
but I hope with in that DLL the function present. here i have used java 1.6 version . kindly give the ideasYou need to have a good look at the JNI documentation.
It isn't nearly as simple as you appear to think. -
How to incorporate .dll files and java
i have one .dll file (that .dll file was not developed by me but i know which methods are there in that .dll file) then how to incorate that one
What exactly do you mean by "how to incoporate" .dll file?
I assume you want to call native methods defined in the .dll file in a java progam.
If so, then this Java Native Interface (JNI) tutorials and code camps at http://java.sun.com/developer/onlineTraining/Programming/JDCBook/jni.html tells you how.
Hope this helps. -
How to Use DLL Function in Java Applet
Hi all,
I have been assigned a task to develop java applet. The problem is, I need to use DLL functions in my applet to read records. Could you pls anyone guide me how to interface DLL and applet to read records with sample code?
I'm using JDK 1.5.0_06 and Windows XP OS. thanx..
best rgds,
jpdbayYou will need to use Java Native Interface JNI. Ther are many posts on the subject, please search, and this is the documentation:
http://java.sun.com/j2se/1.5.0/docs/guide/jni/spec/jniTOC.html -
if i have a DLL file and i want to use them in my program
is it possible to import them for example
import Node.DLL
or what , please tell me it's important for meYou can use the DLL file by using System.loadLibrary().
To use the functions in the DLL, you have to provide a JNI interface to it.
Here's a good link to a tutorial.
http://java.sun.com/docs/books/jni/html/start.html#769
Budyanto -
How to use parameter file with java
Is it possible to use a parameter file with Java, and is there any class/method to make it easy to call and use these parameter from a text file, other than scanning the whole text file manually as we can do normally with visual basic/c++, so we can call the program with the parameter file, like java testing c:\\testing.ini
If I understand you correctly, you may be looking for a properties file. This is basically a text file that contains pairs of strings in the form:
parameter1=value1
parameter2=value2
parameter3=value3
...etc.
and the values are retrieved using the java.util.Properties class - see:
http://java.sun.com/j2se/1.3/docs/api/java/util/Properties.html
Sample use://Call chis method once, to load the props file.
//props file is called "demo.properties", and is
//in a directory that is included in the classpath
private void loadMyProperties() throws Exception
InputStream stream = getResourceAsStream("/demo.properties");
if(stream == null)
throw new Exception("stream is null!");
demoProperties = new Properties();
demoProperties.load(stream);
stream.close();
// Then you can retrieve properties in your code using:
String param3 = demoProperties.getProperty("parameter3");
//...etc -
How can this be done?
Which classes should I use to do this?JNI
http://java.sun.com/j2se/1.4.1/docs/guide/jni/index.html
- Chris -
How to use a VB dll file in java
hi,
i am working on college project,In this output of calculation is not matching with college site .So any one can tell "how to use or combine a VB 'dll' file in java?".so that i can use VB 'dll' file in java to get right Output.
If possible write code or send it to "[email protected]"
Thanks
Ravi kapaniDid you try Google? And no, there is no native support for accessing .dll files from Java. That said, take a look at JNI.
-
How can I using functions implicit in dll file in java code ?
How can I using functions implicit in dll file in java code ?
I'm developing a program that interfacing with fingerprint hardware.
I have the finger print already, and I have to the SDK that have all functions for managing this fingerprint.
These SDK functions are represented in dll files.
I want to know how can I use these functions in java code .
I looked on this link of sun forums :
http://forum.java.sun.com/thread.jspa?threadID=305171&messageID=1215613
but I don't Understand the meaning of native code.
Thanks for help.please please please please please please please please help me:
After reading a lot of articles, tutorials, and overviews about JNI (Java Native Interface)
I found that these steps
1. Develop the Java code
2. Compile the Java code to a class file
3. Generate the header file
4. Implement the native method
5. Create the shared library or DLL
6. Run the Java program
Is the common steps in JNI development
The most powerful link was
http://java.sun.com/docs/books/jni/html/start.html
and
http://www.netbeans.org/kb/55/beginning-jni-part2.html
and the pdf oh this link
http://www.ibm.com/developerworks/edu/j-dw-javajni-i.html requiring IBM registration to download it.
But I have already the DLL, and want to the stright forward way to use its functions by java code only.
I don not to write any C++ code .
Is this possible???????????????????????????????
The name of these dll is �zkemsdk.dll�
It developed by ZKSOFTWARE company for managing a finger print �NP1500A�of
http://www.napcogulfsecurity.com/finger_print.asp
thanks for help -
How can i import dll files in java project in eclipse?
Hi All,
How can i import or link dll files in java project in eclipse?....
dll files contains
import com.ms.com.ComLib;
import com.ms.com.Variant;
import com.ms.com.ComFailException;
import com.ms.wfc.data.AdoException;
import com.ms.wfc.data.AdoEnums;
Any idea of this please tell me.....
I am using eclipse 3.4 and JRE 1.4
Is this possible?
Please tell me!!!!!!!!!!!!!
VoddapallyiMovie cannot edit mpg files, unles they come directly from a supported camera.
I would suggest that you use a free third party app to convert it.
Get MPEG Streamclip from Squared 5, which is free.
Drag you mpg clip into MPEG Streamclip.
Then, FILE/EXPORT USING QUICKTIME
Choose Apple Intermediate Codec, and save it where you can find it. You should be able to import this file into iMovie, using the FILE/IMPORT/MOVIE command.
Note: If your file is an MPEG2 clip, you may need to purchase the Apple QuickTime MPEG2 Playback Component from Apple. MPEG Streamclip will tell you if you need this. Don't buy it unless you have to. It costs about $20. You just have to install the component. MPEG Streamclip will use it in the background. -
How To Read RTF file in JAVA? Using iText?
How To Read RTF file in JAVA? Using iText?.....
import java.io.*;
import com.lowagie.text.*;
import com.lowagie.text.rtf.*;
public class RTF3 {
public static void main(String[] args) {
// System.out.println("This example generate a RTF file name Sample.rtf");
// Create Document object
Document myDoc = new Document();
try {
// Create writer to listen document object
// and directs RTF Stream to the file Sample.rtf
RtfWriter2.getInstance(myDoc, new FileOutputStream("Sample.rtf"));
// open the document object
myDoc.open();
// Create a paragraph
Paragraph p = new Paragraph();
p.add("Helloworld in Rtf file..amazing isn't");
// Add the paragraph to document object
myDoc.add(p);
catch(Exception e) {
System.out.println(e);
//close the document
myDoc.close();
Exception in thread "main" java.lang.NoSuchMethodError: com.lowagie.text.Rectangle.width()F
at com.lowagie.text.rtf.document.RtfPageSetting.rectEquals(RtfPageSetting.java:433)
at com.lowagie.text.rtf.document.RtfPageSetting.guessFormat(RtfPageSetting.java:362)
at com.lowagie.text.rtf.document.RtfPageSetting.setPageSize(RtfPageSetting.java:341)
at com.lowagie.text.rtf.RtfWriter2.setPageSize(RtfWriter2.java:248)
at com.lowagie.text.Document.open(Unknown Source)
at view.RTF3.main(RTF3.java:23)
CAN you HELP me?import com.lowagie.text.Document;
import com.lowagie.text.rtf.parser.RtfParser;
import java.io.FileInputStream;
String inputFile = "sample.rtf";
Document document = new Document();
document.open();
RtfParser parser = new RtfParser(null);
parser.convertRtfDocument(new FileInputStream(inputFile), document); -
How to use .dll compiled in Delphi in Java?
Can anyone provide me information how to use .dll compiled in Delphi in Java? The .dll Delphi program may be non-OOP program.
Hi
If You want to write anything in PASCAL then simply write JNI code in C++ and call functions from this DELPHI DLL, but remember about changing the order of parameters etc when You call it. I had exactly the same problem, but it is possible, and we succeed.
You will need exact description of input parameters required by PASCAL functions and of output parameters. Then construct in C++ objects wchich looks in memory exacly the same as they will look if You will be using PASCAL. Then PASCAL function will interprete this area in memory as known structure and will run.
Maciek -
Hello friends...
i have dont coding in java (windows based)
no i want to use .so file in java...
can i use it in java because c++ coding is done in linux and .so file is generated..
So can i use directly .so file in java (windows based).
Please give reply...
thank...You can use a wrapper to call C methods in a DLL under windows or in a lib*so under *nix.
There are many commercials products to do this : google for them.
There is at least one LGPL product : jnative.
Beware that most of those products do not work for C++ exported objects since they can't be "newed".
BTW : If anybody knows how to new a C++ object by its name (like Class.forName()) : write me at http://sourceforge.net/projects/jnative
--Marc -
How to use dll in Labview ?
I compile this code to dll file with VC++2010 filename is test_dll.dll .
#include "stdafx.h"
#include <iostream>
#include <Windows.h>
using namespace std;
int main(int a){
cout << "Test dll...............\n";
return a;
After that, I put Call Library Function node in editor and double click Call Library Function node. I browse test_dll.dll into Library name or path and set function prototype to int32_t main(int32_t a); but it show error Call Library Function Node 'test_dll.dll:main':function not found in libraly. How to use dll in Labview ? And I have more question is what is differrent from Tools -> Import -> Shared Library(.dll) and use Call Library Function node.
Solved!
Go to Solution.The issue you are having is that LabVIEW is not capable of using C++ DLLs directly. It only handles C DLLs. This does not mean that if you you cannot use the DLL if it's compiled with the C++ compiler as opposed to the C compiler. Rather, it means that you must take extra steps in order to use it from LabVIEW. The primary issue is that of name mangling or adornment. This is discussed here: http://zone.ni.com/devzone/cda/tut/p/id/4877. Basically you need to prepend extern "C" in front of your prototypes in your header files. I would also suggest reviewing this article: https://decibel.ni.com/content/docs/DOC-14564.
-
Hi,
I want to use properties file in my application. I have kept properties file inside a directory called properties which is inside myProject(which is the parent directory of my project) i.e "myProject/properties".
My java file where i want to call this properties file is inside the myProject/WEB-INF/src/java.
How can i call the properties file from myProject/WEB-INF/src/java/PropertyReader.java
I wrote java program in myProject/WEB-INF/src/java/PropertyReader.java like:::::
ResourceBundle resBun = ResourceBundle.getBundle("Test", Locale.getDefault()); // Test.properties is inside myProject/properties
resBun..getString("name");
After running the program i am getting the following errors:::::
Exception in thread "main" java.util.MissingResourceException: Can't find bundle for base name Test, locale en_US
at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:836)
at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:805)
at java.util.ResourceBundle.getBundle(ResourceBundle.java:576)
at PropertiesReader.main(PropertiesReader.java:4)
What is the issue? How to use properties file?
Waiting for reply.
ThanksStill getting same exception. As you explained i tried like the below:::
1. I am using ant as build tool.
2. My properties file is for database configuration
My properties file is::
database.properties (inside myProject/properties)
JDBCDriver=org.gjt.mm.mysql.Driver
JDBCConnectionURL=jdbc:mysql://pmdbmysql:3306/bandwidthshaper?user=admin&password=admin
My java package structure is
WEB-INF/src/java
WEB-INF/src/classes
For build WEB-INF is the base directory and build.xml is inside the src directory
In my build.xml i wrote the following lines for compilation::
<target name="compile" >
<javac srcdir="src" destdir="src/classes" debug="true" debuglevel="lines,vars,source">
<classpath refid="class.path"/>
</javac>
<copy todir = "src/classes" >
<fileset dir = "../properties" />
</copy>
<jar jarfile="lib/${project.jar.file}" basedir="src/classes"/>
</target>
I am copying properties file to the classes directory.
Now in java file which is inside /WEB-INF/src/java, I wrote::
try {
Properties programProps = new Properties();
InputStream is = getClass().getResourceAsStream("/database.properties");
if(is == null)
throw new IllegalStateException("Properties file missing ");
programProps.load(is);
System.out.println("driver name::::::: "+programProps.getProperty("JDBCDriver"));
is.close();
} catch(Exception e) {
e.printStackTrace();
After compilation in my classes directory i am getting database.properties file and my java file with package.
At the time of running i am getting "java.lang.IllegalStateException: Properties file missing"
Now tell me where is the fault. Why again i am getting exception.
Thanks
Maybe you are looking for
-
UD Connect: UDCADAPTERROR::RSSDK|100| error
Hi All, My RFC connection with J2ee is perfect. While creating DataSource and while selecting Source Object getting following error. UD Connect: UDCADAPTERROR::RSSDK|100|Cannot open the connection Using BI 7.0 SP9. Thanks, Nagesh
-
Creation of Application module failed
Hi all, I'm trying to deploy BC4J as EJB on OAS4.0.8.2 (OAS and Oracle 8.1.6 on Solaris 2.7). Deployment went OK, I can open Business Component browser but in Object Members View I can see only 2 records for each view (looks like recordset properties
-
2012 r2 rds deployment cannot connect to sql server after reboot
We have a ha connection broker setup with 2 connection brokers and everything was working fine up untill the servers were rebooted for updates. Now users cannot connect to thier collections and I have an error in the event log that the deployment cou
-
Cant install creative suite 5.5
hi. please help. i ve originally bought creative suite 5, then it was upgraded to 5.5 it was installed on my old laptop which got damaged , so now i am trying to install it on my new laptop using serial number from my adobe account. however it says t
-
the problem is i am doing accordion menu and when i dont know where to insert the *<%=request.getAttribute("distributions")%>* Thank u in advance. <div id="sdmenu" class="sdnm_flat" style="display:none"> <dl class="top_lft"><dd> </dd></dl> <span clas