Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2007

Tip: Looking for answers? Try searching our database.

using a native dll in java

Thread view: 
tommygun101 - 23 Jun 2007 21:23 GMT
Hey people

i am using eclipse and i tried to use jacob to run the following code,
which links java to this scripting language called autoit.

package core;
import com.jacob.com.*;
import com.jacob.activeX.*;
import java.util.*;
import java.io.*;

public class Index {

    /**
    * @param args
    */
    public static void main(String[] args) {

        try{
              Runtime.getRuntime().exec("regsvr32.exe /s AutoItX3.dll");
            } catch (IOException ex){
              ex.printStackTrace();
            }
            ActiveXComponent AutoIt3 = new
ActiveXComponent("AutoItX3.Control");
            AutoIt3.invoke("Run","notepad.exe");

    }

}

I set the parameters in run>arguments>vm arguments

-Djava.library.path=<G:\mainpath\AutoItX3.dll>
-Djava.library.path=<G:\mainpath\jacob.dll>

and i added the jacob.jar file to the classpath

But i still get a runtime error,

Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob in
java.library.path
   at java.lang.ClassLoader.loadLibrary(Unknown Source)
   at java.lang.Runtime.loadLibrary0(Unknown Source)
   at java.lang.System.loadLibrary(Unknown Source)
   at com.jacob.com.LibraryLoader.loadJacobLibrary(LibraryLoader.java:
57)
   at com.jacob.com.JacobObject.<clinit>(JacobObject.java:150)
   at core.Index.main(Index.java:20)

Oh.. and placing the dll's in the c:/windows/system folder doesnt help
and i also added the dll to the java/jre/bin/ext and that doesnt help
iether

I have been searching the net , trying to figure out whats going wrong
please could you help me out

thanx
Roedy Green - 24 Jun 2007 07:24 GMT
>Exception in thread "main" java.lang.UnsatisfiedLinkError: no jacob in
>java.library.path
[quoted text clipped - 5 lines]
>    at com.jacob.com.JacobObject.<clinit>(JacobObject.java:150)
>    at core.Index.main(Index.java:20)

You did not show your loadLibrary code.  See
http://mindprod.com/jgloss/jni.html

You don't tack on .dll.  Different platforms tack on different
extensions.

--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
tommygun101 - 24 Jun 2007 16:20 GMT
I am not sure if you are familiar with Jacob, but it is a java-COM
bridge library
That does all the interfacing for you,

i didnt put load library code because i specified it in the vm
arguments in the run
setting

but i will take a look at the link you sent me.
Frank Langelage - 24 Jun 2007 17:52 GMT
> I set the parameters in run>arguments>vm arguments
>
> -Djava.library.path=<G:\mainpath\AutoItX3.dll>
> -Djava.library.path=<G:\mainpath\jacob.dll>

java.library.path must point to the directory(ies) where the shared libs
are, it must not include the name itself.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.