Accessing DLL files from Java

I have a problem with Java, and the problem is that I'm trying to call a DLL file declared by C++ only but without a support for Java programs, is what I'm aiming for going to be available by using the rundll32.exe file.
Note: I'm trying to use the (skydll.dll) file for controling skystar2 DVB card.
Message was edited by:
JZoro

You cannot directly call a DLL from Java unless the DLL exposes entry points that are compatible with the JNI calling conventions.
For example a Java class calling a native function like below:
class Arguments
   private native void setArgs (String[] javaArgs);
   public static void main (String args[])
      Arguments A = new Arguments();
      newArgs[] = A.setArgs(args);
   static
      System.loadLibrary("MyArgs");
}Needs a DLL entry point with the following signature:
JNIEXPORT void JNICALL
Java_Arguments_setArgs (JNIEnv *jenv, jobject job, jobjectArray oarr) {Notice that the first parameter of the method is of type JNIEnv and the second can be either a reference to a class or Java object instance.
Jacques Gonzalez
J4SOFT

Similar Messages

  • How to access methods in existing dll file from java

    I have a dll file and that file contains two methods.
    Now I would like to access those two methods in java program.
    How to access these methods.
    Give me the sample code for this problem.

    http://forum.java.sun.com/thread.jspa?threadID=757125&tstart=0

  • Error accessing PDF files from Java

    In CF7, I have a routine that opens submitted PDF files
    through Java to do some manipulation. Similar to CF8 PDF
    manipulation, but more complex. In almost all cases, it works fine,
    except two.
    For one, a submitted PDF was corrupted somehow -- I can't
    even open it with Acrobat. On the line:
    "reader=pdfReader.init(pdfFile);" this returns the error below.
    This is expected. But with a couple other PDF's, that do open fine
    in Acrobat, I get the same error. I even re-saved the PDF file to
    different versions of Acrobat, but java still complains. Any ideas
    what causes this, or what to do to prevent it?
    Does anyone know if CF8 java processing does anything
    different here that would prevent problems like this?
    reader=pdfReader.init(pdfFile);
    An exception occurred when instantiating a java object. The
    cause of this exception was that: .
    From the stack trace:
    java.lang.reflect.InvocationTargetException
    at
    sun.reflect.GeneratedConstructorAccessor48126.newInstance(Unknown
    Source)

    It does always happen after having successfully done others,
    as these are in a list of about a dozen that it processes at a
    time... but it is always consistent - it does all the others fine,
    and then always breaks on these particular PDF files, time after
    time, day after day. So it's not a random thing that comes and
    goes.
    The 3rd party tool is the one that's "built-in" to CF,
    com.lowagie.text.pdf.PdfReader. This is all on a shared host, and
    so I wouldn't have access to installing alternatives.

  • How to access physical files from java platform

    Hello All,
    We have one JDE Word Writer program, which export the order master data in the DB2/400 Physical files.
    We want to access this data from our java program (reside on windows platform). I am wondering how we can do that. I got one hint that can be accessed by ODBC connection. But I am unable to get the correct ODBC driver. I am looking for correct driver to access the data.
    If some one has done this already, please help me. Or suggest me any alternate way.
    Dinesh

    Can use File class to write code to examine and manipulate file.
    Tutorial: http://java.sun.com/docs/books/tutorial/essential/io/file.html

  • What path to use to access network files from Java app running on Mac

    I have a Java app running on a Mac with OS X that I'm using to check for files that exists on Windows servers within our network.
    Using a path like /Volumes/<Share>/ works because I've already connected to the drive using Finder. If I try to use a fully qualify the path with "smb://<Server>/<Share>" then my app doesn't see anything. Is there any way that I can get Java to connect to a directory without first having mapped or made the connection via some external tool like Finder?
    Here's the code I'm testing with:
    package FileImports;
    import java.io.File;
    import java.util.Arrays;
    public class Dir {
    static int indentLevel = -1;
    static void listPath(File path) {
    File files[];
    indentLevel++;
    files = path.listFiles();
    if (!(files == null)){
    Arrays.sort(files);
    for (int i = 0, n = files.length; i < n; i++) {
    for (int indent = 0; indent < indentLevel; indent++) {
    System.out.print(" ");
    System.out.println(files.toString());
    if (files[i].isDirectory()) {
    listPath(files[i]);
    indentLevel--;
    } else System.out.println("Directory not accessible!");
    public static void main(String args[]) {
    // this path works where <share> = the directory where my files exist.
    listPath(new File("/Volumes/<share>"));
    // this path returns a null result in files
    // listPath(new File("smb://<Server>/<Share>/"));
    Thanks,
    Alex
    Edited by: agates on Sep 25, 2008 11:14 AM

    agates wrote:
    Thanks for the response. I'll have to dig a little deeper into JCIFS. It looks like it would work great windows to windows. I haven't been able to find in the documentation where it would work on OS X without having to mount the targeted file system first. Has anyone had success creating a connection to a windows file system from OS X with JCIFS?Since jCIFS is written in pure Java and implements the entire SMB/CIFS protocoll on it's own it doesn't require any support from the OS (apart from a normal JVM runnig). Thus it should work exactly the same in OS X and Windows (and Linux and Solaris and ...).

  • Accessing .properties file from java code

    Hi,
    I want my java code in a Tomcat Web Application to access values in a custom .properties file.How can i do it.
    Any sample code / suggestions welcome.
    Thanks
    Vignesh.

    ResourceBundle vResourceBundle = ResourceBundle.getBundle("database", Locale.ENGLISH);
            sDriverName = vResourceBundle.getString("database.DriverName");
            sDbURL = vResourceBundle.getString("database.DriverUrl");
            sDbUser = vResourceBundle.getString("database.UserName");
            sDbPasswd = vResourceBundle.getString("database.PassWord");Where "database" is the name of the property file. ie., database.properties.
    the content of the database.properties file
    # Properties to access dabase                 
    database.UserName = scott
    database.PassWord = tiger
    database.DriverName = oracle.jdbc.driver.OracleDriver
    database.DriverUrl = jdbc:oracle:thin:@nn.nn.nn.nn:port:orartgnull

  • 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 kapani

    Did you try Google? And no, there is no native support for accessing .dll files from Java. That said, take a look at JNI.

  • Accessing XML files through java

    Can any one explain me the easiest way of accessing XML files from Java.

    Hi,
    If you want to only access the XML file, use the SAX parser It will be very easy to handle and identify the element and value.
    else if u want to change the XML value also, then better go with DOM, Which has very good flexiblity.
    use according to the need, let me know if any help is required......
    With Cheers
    PrasannA

  • Use .dll files in Java

    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 ideas

    You need to have a good look at the JNI documentation.
    It isn't nearly as simple as you appear to think.

  • Accessing files from Java Stored Procedures

    I am trying to access a file from a Java Stored Procedure but get the exception: "no such file or directory". The path and filename as seen by the database JVM is "\\wgcaub01\a1500is\fabi\mmv\mmvtestdata.txt".
    I have granted permissions to open the file using:
    call dbms_java.grant_permission('MMV', 'java.io.FilePermission', '\\\\wgcaub01\\a1500is\\fabi\\mmv\\mmvtestdata.txt', 'read');
    a) When I run the program as a Java class using a main method it works so the problem has to do with the Oracle JVM not finding the file.
    b) The MMV user has permissions on the file after granting them using the above dbms_java.grant_permission command.
    Can you tell me what am I missing? Is this a database configuration issue? Is there a problem with using a UNC path?
    (I am using FileReader and BufferedReader.)

    Vincent,
    Not sure if this is the cause of your problem, but I had some Java code which read from/wrote to a file, and I needed to run the following (you can obviously change <<ALL FILES>> to something more restrictive):
    declare
    security_key number;
    begin
    dbms_java.grant_permission('DAN', 'java.io.FilePermission', '<<ALL FILES>>', 'read,write,execute,delete', security_key);
    dbms_java.grant_permission('DAN', 'java.lang.RuntimePermission', 'writeFileDescriptor', NULL, security_key);
    dbms_java.grant_permission('DAN', 'java.lang.RuntimePermission', 'readFileDescriptor', NULL, security_key);
    end;
    Note that the security_key won't be set if the grant didn't work.
    Hope this helps,
    -Dan
    http://www.compuware.com/products/numega/dbpartner/dbpordebug.htm
    Debug PL/SQL and Java in the Oracle Database

  • 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!!!!!!!!!!!!!
    Voddapally

    iMovie 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.

  • Calling C Functions in existing DLL's from Java

    Hi Guys ,
    The tutorial in this site talks about creating ur own DLL's and then calling them from Java . I need to call C functions in existing DLL's from Java . How do I go about doing this ? . Any help on this would be much appreciated.
    regards
    murali

    What you are interested in can be done with what's called "shared stubs", from the JNI book (http://java.sun.com/products/jdk/faq/jnifaq.html), although you don't need the book to do it (I didn't).
    The example code will call functions with any number and kind of parameters, but doing that requires some assembly language. They supply working examples for Win32 (Intel architecture) and Solaris (Sparc).
    If you can limit yourself to functions to a single function signature (number and types of parameters), or at least a small set that you know you'll call at compile time, you can modify the example so that the assembly language part isn't needed, just straight C code.
    Then you'll have one C library that you compile and a set of Java classes and you can load arbitrary functions out of arbitrary dynamic libraries. In my case you don't even have to know what the libraries and functions are ahead of time, the user can set that up in a config file.
    You mentioned doing this with Delphi. One thing to watch out for is C versus Pascal (Win32) function calling convention. A good rule of thumb; if it crashes hard, you probably picked the wrong one, try the other. :-)

  • Packaging dll files in java application

    Hi all,
    I am working on an application where I use some dll files from my java application. Now I would like to package the application so that end users can easily install and use them. the Java application is currently packaged as a jar file. How to i package the dll files? Where should I copy these files to on a target system.
    I tried packaging my application and installing it. But I get the following error: "Exception in thread "main" java.lang.UnsatisfiedLinkError". How do I resolve this error.
    Thanks for advance,
    Abdel

    Make sure that the dll files is in the library path.
    VM option example:
    -Djava.library.path=.\dll

  • Generation of xml file from java code

    hi,
    I want to manipulate data in a xml file with java code.I have read data from xml file and also changed it. But i am unable to covert it again in xml file from java code. Can you please tell me how i can do this?

    Let me know which parser are you using currently for reading xml files so that i assist you. For now, you can refer to STAX Parser API under this link
    http://java.sun.com/webservices/docs/1.6/tutorial/doc/SJSXP3.html

  • The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? is there a cable i can connect to another mac that will let me transfer the file?

    The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? The mac turns on the screen freezes as bright blue.  Is there a cable i can connect to another mac that will let me transfer the file?

    There is another option if the Macbook will start up in Target Disk Mode.
    Restart the computer while holding down the T key. If you see the firewire symbol moving around on the screen you can connect this one to another one in TDM. You will need a suitable cable to connect the two Macs.
    http://support.apple.com/kb/ht1661
    Firewire symbol:

Maybe you are looking for

  • Error six when I try to open Photoshop Elements

    I own Elements 8, and it didn't successfully transfer from my former computer to my newest MacBook Pro. I.e., it told me to reinstall. That's not easy to do, since my new Pro doesn't have a disk drive, so I transferred the Elements file on a USB hard

  • Mac mini 2

    i have a mac mini 2.0/2*512/120/sd/ap/bt - iea it is co,patibale with mac osx 10.6 snow leopard? thanks <Personal Information Edited by Host>

  • Use diff3 to create a new file based on "deltas"

    I had som dos software once... from Burton System, nifty. Tlib. Unfornately I have dumped the manuals. I need to create a new file based on deltas between to others, and I thought diff3 could do the trick; the thing is that i cant remember how. I wan

  • Right arrow & Enter key do not have any effect in Address/Awesome Bar

    I enter the first few characters of the website - I can use the down arrow and Enter key to select the website but nothing happens. I have the correct website address but neither right-arrow nor the Enter key (again) work to take me to the website I

  • Does Novo Button depend on the partitions?

    I 've recently purchased an Ideapad S400U. I am thinking to wipe everything from it. That is, I'll delete the OEM Windows 8 and its related partitions. That is because I intend to install Windows 8.1 (I've got its test version from DreamSpark). Besid