aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Configuring eclipse to use dll files at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Configuring eclipse to use dll files at runtime" Watch "Configuring eclipse to use dll files at runtime" New topic
Author

Configuring eclipse to use dll files at runtime

Swapnil Shroff
Ranch Hand

Joined: Mar 07, 2006
Posts: 58
Hi

How do i configure eclipse to use a dll file at runtime.

I have 2 dll files for example one.dll and two.dll

the two.dll is referred by dll one.dll

now i have put both files in jre\lib folder.

at runtime eclipse can find one.dll but gives error for two.dll.

any idea..any solutions..please advice.

thanks


SCJP 5, SCDJWS<br /> <br />It's amazing how premature optimisation is both seductive and destructive; even when you know
Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
I haven't tried this, but this is what I think.
the dll files should be available on the classpath, when you run the program. One way to put these dll files on the classpath is to add the directory, in which the dll files exist, to the classpath.

You can do so by selecting project properties-- > Add Class Folder option.

Hope that helps,

Cnu,


formerly known as Cnu
Swapnil Shroff
Ranch Hand

Joined: Mar 07, 2006
Posts: 58
this is not working

it takes only jar in classpath
Swapnil Shroff
Ranch Hand

Joined: Mar 07, 2006
Posts: 58
this is not working

it takes only jar in classpath
Pavan Kumar
Ranch Hand

Joined: Jan 23, 2004
Posts: 78
Swapnil, pay attention to the options you have when you open project propeties dialog. There are various options, if you choose to add jars or add external jars to the classpath, ofcourse it would let you add jar or zip files only.

You have to try add class Folder option, where in you can add a folder to your classpath and this folder can contain anything in it.

Hope that helps.

Cnu.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

Eclipse is not a Microsoft Windows application. That is, there's no code in it that makes it substantially dependent on Windows instead of Linux.

DLL's are binary code libraries, and no Java program can access DLL's directly, including Eclipse. Instead, you have to wrap the DLL functions and/or data in JNI (Java Native Interface) Java classes. The JNI modules are generally written in C and compiled, and as part of the C code in the JNI module, you'd use the LoadLibrary call to load the DLL just like any other C program module would. Neither Eclipse nor the JVM ever see the DLL directly.

And, of course, any code you produce using JNI DLL-calling classes will only run on Microsoft Windows.


Customer surveys are for companies who didn't pay proper attention to begin with.
Swapnil Shroff
Ranch Hand

Joined: Mar 07, 2006
Posts: 58
yes of course I am using JNI and loadlibrary to use DLL files. what i meant to say is that after doing all setting for JNI, my java program can find the immediately referencing DLL file if i put it under jre/lib folder but it doesn't find the DLL used by this dll.

we have entire configuration done for our environment in jbuilder now only thing is that we have to configure eclipse similarly so i think there must be some way in eclipse.

And, of course, any code you produce using JNI DLL-calling classes will only run on Microsoft Windows.


I am not sure about this but our application is developed for unix as well as windows users so i think it should work for UNIX also
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16250
    
  21

The classpath has no relation to binary system library loading paths. Classpaths are used only to resolve requests for Java resources.

n a Windows app, there's a predefined set of places that the system DLL loader will attempt to load from (consult MSDN), plus you can force loading from places you designate. The docs on the LoadLibrary function were fairly clear and accurate last time I used them. Hopefully Microsoft hasn't messed them up.

DLLs do not exist in any Unix system. The equivalent construct is a dynamic Shared Object, which is usually created using the "ar" utility. These libraries have the file extension ".so". An ".so" isn't quite the same as a DLL, though the basic concepts are similar. For one thing, Unix has somewhat better support for maintaining multiple active library versions, though it also lacks one or 2 things that Windows DLLs have.

If you ARE producing an SO, the normal process is to include it in the library search path, as defined by an environment variable named something like SYSTEM_LOAD_LIBRARY - but my memory's not accurate on its exact name. You may also need to register the SO's directory location with system utility program.
Meena Nikode
Greenhorn

Joined: Nov 27, 2009
Posts: 3
I was also facing the problem while configuring dll in eclipse.

One way I tried is to put jars in classpath using add jars/external jars utility in project properties and all my jars as well dll I got selected to add the same. But ofcourse it would add jars/zip files only.

One option is to try keeping that dll in your <JDK>/jre/bin used in eclipse system library and was able to configure dll files at runtime , by placing dll in /jre/bin ..
Anuradha Rao
Greenhorn

Joined: Mar 13, 2010
Posts: 1
Provide the path to your dll in the VM agrs in eclipse like this. It should work.

-Djava.library.path="{dll path}"
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5843
    
    7

You can always add the directory containing your DLL to the PATH (Linux translation: directory containing .so to LD_LIBRARY_PATH). Back when I was doing some development that required native calls to DLLs, I had a PATH entry specifically for the DLLs I was using.


JBoss In Action
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Configuring eclipse to use dll files at runtime