JVM does load DLL within JAR executable

Hi,
I'm not sure the following problem is related to this forum but...
I have problem to load native code (DLL) by running executabe JAR file(created by JBuilder 9).
The program runs fine within JBuilder & Eclipse compilers.
When run the EXE an error says "JVM cannot load the DLL" in java library path.
I have tried without succes:
1. Loading dll in main function: [System.load() & System.loadlibrary()].
2. Running JVM with parameter: -Djava.library.path=<DLL path>
* running the class with "java" application works fine as well.
Any ideas?
Thanks,
AST

I extract the DLL file to working directory if necessary, also the DLL is stored in System32 & working directories (the directories are part of Java library path).
Normally,the DLL is loaded by external package that embedded to program, could it be that executable JAR blocks access to native code?
Thanks,
AST

Similar Messages

  • (LDOM) The file just loaded does not appear to be executable.

    Sorry if this is not the right forum - it seems to be the closest one for things about LDOMs; plese let me know if I should post somewhere else.
    I have installed LDoms_Manager-1_2.zip on a T5220 Server; following the book ("Logical Domains 1.2 Administration Guide") I set up the control domain etc, then a guest domain (cranachan) - so far all appears well. I downloaded the dvd iso of Solaris 10 (sol-10-u7-ga-sparc-dvd.iso) and added it to the guest as described, started the domain and issued "boot vdisk_iso:f -v" - this seemed to work well, but there was an error that turned out to be that I had given the wrong path for the system disk.
    So I started over - removed the guest domain and the disk definitions for both guest and control domain, and removed the guest; then recreated everything. This time, when I "boot vdisk_iso:f -v" I get:
    The file just loaded does not appear to be executable.
    Any idea what may have happened? It makes no sense to me; not unless the iso file has been corrupted, but it doesn't seem to have been modified, and I can mount it as a loop-back fs in linux.

    I have the same problem with a Netra T1 system. Solaris 10 installed fine and it won't boot. It did have Solaris 8 on the system, but I put in new drives to start my Solaris 10 install.
    I tried booting to single user cd-rom (ok boot cdrom -s) and ran this:
    # installboot /usr/platform/SUNW,UltraAX-i2/lib/fs/ufs/bookblk /dev/rdsk/c1t0d0s1
    (SUNW,UltraAX-i2 was derived from # uname -i)
    It didn't help.
    I also tried "setenv diag-switch? false" at the okay prompt. It didn't help
    Any thoughts?

  • Error The file just loaded does not appear to be executable.

    Hi there,
    I have some problems with a Sun Fire T2000. Solaris 10 was installed one year ago. The server went down and now I am trying to connect to recover the dates and make a new installation.
    Booting the server, I don't get any message. If I type #. I reach to sc> mode and from there I can get to ok prompt. From either mode, I can't get in the operating system.
    From the ok prompt I issued "show-disks" and I booted with the cdrom choosing the option from the output of "show-disks". I got the "The file just loaded does not appear to be executable."
    I searched the error and then I booted with "boot cdrom -s" and I got the "ERROR: /virtual-devices@100/console@1: Last Trap: Division by Zero".
    Please advice for a new installation.
    Thank you.

    Hi, and again thanks.
    I understood that this server runs on different levels, like with firmware OpenBoot (ok prompt) or System Controll (sc>).
    I understood the different setups can be made from ok prompt, like the problem I have now.
    I am at the ok prompt. The "printenv" showed me that I was booting from net1, which is wrong because the installation just ended. So I changed to "disk" following your indications. I checked with printenv and indeed the boot sequence was changed to boot disk.
    I issued the boot command I after the message "Boot device: disk File and args:" it looks like hanging. I am sure I can get back to sc> prompt but it looks like a loop to me: how do I get into the operating system? I looks I can switch only from ok to sc and backwards. But, after booting I'd like to enter in Solaris OS, not OpenBoot firmware or System Control...
    Thank u for the time and listening.

  • Does loading too many classes into jvm slow down performance?

    hi all,
    does loading too many classes into jvm will slow down performance. Our application is CPU bound, if we use any framework we need to load all the classes related to that framework in JVM. Does this have any effect on the performance of the JVM.
    thanks and regards,
    akmal

    does loading many classes into jvm slow down performance.It will increase the time it takes for the JVM to load your application.
    Our application is CPU boundThe time it takes the JVM to load your application is not likely to be an issue for you then.

  • How to run a Jar executable with non standard JVM memory settings

    Hi,
    I have a jar-executable that needs more memory than the JVM uses by default.
    The application works with:
    java -Xms128M -Xmx256M myapp
    How can the jar know that it need to start like this?
    I found a solution here http://forum.java.sun.com/thread.jsp?forum=32&thread=188484 , but i don't want to do this with a shortcut.
    Is there anyway to do this?
    Thanx in advance.

    Well i'll do that:
    public class launch
      public static String getJarPath()
        String path="";
        try
          StringTokenizer st = new StringTokenizer(System.getProperty( "java.class.path" ) ,System.getProperty( "path.separator" ) );
          String jarfile = "";
          while ( st.hasMoreTokens() )
            String token = st.nextToken();
            if ( token.indexOf("launch.jar") > -1 )
               jarfile = token;
               break;
          if ( jarfile.equals("") ) throw new Exception( "Jar not found in classpath" );
          path = jarfile.substring( 0 , jarfile.indexOf("launch.jar"));
       catch (Exception e)
        new AlertWin(e.toString());
       finally
        return path;
      public static void main(String[] args)
        try
          String path=launch.getJarPath();
          Runtime.getRuntime().exec("javaw -Xms128M -Xmx256M -jar " + path + "toBeExecuted.jar");
        catch(IOException e)
          new AlertWin(e.toString());
    }The launch.jar has to be in the same dir with the toBeExecuted.jar. (ofcourse that could change and the code is much simpler).

  • Jar executable issue after jvm update

    I created a small demo application and bundled my classes and media files in a jar executable file. Everything was fine until I updated J2SE from 1.5.0 to 1.6.0_01.
    The application now starts, gets its input normally but soon after hangs, and the Swing GUI doesn't show up anymore.
    The jar file contains 4 packages (one of them contains the main class) and this simple manifest file:
    Main-Class: myapp.myAppLauncher
    Classpath: .\myapp.jar
    I created the jar as follows:
    jar cvfm gdv.jar Manifest.txt myapp mypackage2 mypackage3 mypackage4
    I recompiled the source before creating the jar archive, and if I launch the application from the console I see no difference from before. The problem is only for the jar version.

    Manually download and install the Java 4 update http://www.apple.com/downloads/macosx/apple/application_updates/javaformacosx105 update4.html, and Safari 4.0.1 http://www.apple.com/safari/download/ Run Software update, install anything that pop up, repair permissions, and restart. That should fix your problem.

  • How to load an applet jar file?

    Hello everyone,
    I have an applet that uses my own jar file and approximately 6 third party jar files. I set up jar indexing (jar -i) which will download the jar files when they are needed. All seems to work well, but now I want to manually load the jar files which I cannot get working.
    When the applet starts, about 1/2 of the jar files are downloaded (because they are needed at startup). I then want to load the additional jar files in the background, after the gui is initialized. I have tried this using the below thread which is executed from within the applet's start method:
    // Try to load additional jar files in background by loading a class from each jar file.
    Thread loadClass = new Thread() {
      public void run() {
        System.out.println("Loading classes...");
        try {
          // Tried loading classes this way, doesn't work.
          getClass().getClassLoader().loadClass("pkg1.Class1");
          getClass().getClassLoader().loadClass("pkg2.Class2");
          getClass().getClassLoader().loadClass("pkg3.Class4");
          getClass().getClassLoader().loadClass("pkg4.Class4");
          /* Loading classes this way doesn't work either.
          Class.forName("pkg1.Class1");
          Class.forName("pkg2.Class2");
          Class.forName("pkg3.Class3");
          Class.forName("pkg4.Class4");
        catch(ClassNotFoundException e) {
          // First attempt to load a class (pkg1.Class1) throws exception.
          System.out.println("Can't find class: " + e.getMessage());
    loadClass.start();As you can see from above I am trying to load a class from each of the jar files so that the jar files would load into memory/cache. Unfortunately, it cannot find the classes. These are the errors from the java console:
    Loading classes...
    Loading: pkg1.Class1
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with no proxy
    Connecting http://my.server.com/my_dir/pkg1/Class1.class with cookie "JSESSIONID=some_big_long_char_list"
    Can't find class: pkg1.Class1
    So it appears the jar file is not being downloaded. When I take away the dynamic jar loading (removing the "jar -i" & adding them all to the applet archive list) the thread executes correctly. So I know the class names, etc, are correct. How does one load an applet jar file?
    Any help/suggestions are appreciated.

    The above error I posted was because I forgot to index the jar files. That is why it couldn't find the jar file. I thought I was getting farther along with my problem, but I apparently just forgot to index the jars. I am now getting the problem that I got yesterday...
    The applet freezes/hangs when it hits the thread. The GUI never opens (even though I'm running this thread right after the gui shows). The java console quits responding and the applet just stays the grey screen. I also tried the invoke later that you suggested.
    public void start() {
      // ...initialize gui...
      // Applet freezes and remains grey, also the java console freezes.
      javax.swing.SwingUtilities.invokeLater(new Runnable() {
        public void run() {
          System.out.println("Loading classes...");
          try {
            // When I comment out the below forName calls, the thread will still run evidenced through the done print statement.
            Class.forName("pkg1.Class1");
         Class.forName("pkg2.Class2");
         Class.forName("pkg3.Class3");
         Class.forName("pkg4.Class4");
            System.out.println("...Done loading classes");
          catch(Exception e)     {
            System.out.println("Can't find class: " + e.getMessage());
    }

  • Error Message : Unable to load DLL (AddOnInstallAPI.dll)

    Hi there..
    I am lost in SBO Installation I have made an installation package for my add-on. When I want to deploy for my client, i get a very silly Microsoft .Net Framework error message, that is :
    Unable to load DLL (AddOnInstallAPI.dll)
    Here is my function to call the .dll file:
    Private Sub Install()
      Environment.CurrentDirectory = strDll
      Dim sInstaller As String = installerPath
      'installerPath is path for my Setup.exe file
      Try
         'Run a new process
         System.Diagnostics.Process.Start(sInstaller)
      Catch ex As Exception
         MsgBox(ex.Message)
         Windows.Forms.Application.Exit()
      'Loop until windows found the executables   
      While System.IO.File.Exists("C:\Program  Files\MyCompany\Statement of Account\SOA.exe") = False
      End While
      'After found the executables, then call SetAddOnFolder
      SetAddOnFolder("C:\Program Files\MyCompany\Statement of Account")
       EndInstall() ' Inform SBO the installation ended
       Windows.Forms.Application.Exit() ' Exit the installer
    End Sub
    Does anybody ever face the same problem? My Client are using SBO2004 P9. I created all my addon using SDK P23. Is there any effect using different patches?
    Just for your information, I try to uninstall everything, and re-install SBO2004A Patch 9 in my computer (same as my client) and it works fine!! Are there any other possibilities???
    Hopefully, somebody can help me...
    Thanks alot...

    yes, i put the correct strDLL string as the parameter. I am able to run the AddOnInstaller with my PC (SBO 2004A Patch 26) and I also did the installer using my PC.
    My Problem is that i can not to install in my customer PC which is using SBO2004A Patch 9.
    Does anybody has some ideas about this issue?
    Thanks for helping...

  • Unable to load DLL 'OraOps10w.dll'

    I am getting a strange error in a production environment. I have a service that is written in .NET and is using ODP. Everything with the service is running fine, but we are getting the following error when running one specific stored procedure:
    Unable to load DLL 'OraOps10w.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)
    The stored procedure is actually executing without error, but this error is occurring in .NET. It has all of a sudden started happening on us yesterday and we have tried to restart the service and also rebooted the server. The DLL does exist on the server and we verified it has the proper security. I am very puzzled by this, because everything appears to be working as normal.
    Any help is appreciated to try and troubleshoot this problem.
    Thanks!

    Hello,
    Please see this thread:
    Re: After upgrading to ODP.NET 10.1.0.400 existings Apps fail.
    This is almost always a permissions issue.
    - Mark

  • How to load images when loading application from Jar

    Hi,
    my program runs fine and all the images load from within Netbeans but the images dont load when I run the application from the executable Jar I created.
    In netbeans I used:
    Image image = Toolkit.getDefaultToolkit().getImage("images/fractions/image1.png");This works when run from netbeans but not from the Jar file.
    I created the Jar file using Netbeans Clean and Build function. Should this include the image files (which are located in an image folder 1 directory below the src folder were the .java files are located) or do I have to somehow explicitly say that the Jar should contain the images? or is there another reason the images aren't loading?
    Any help appreciated

    Hi,
    my program runs fine and all the images load from
    within Netbeans but the images dont load when I run
    the application from the executable Jar I created.
    In netbeans I used:
    Image image =
    Toolkit.getDefaultToolkit().getImage("images/fractions
    /image1.png");
    You should be use the getImage() method that takes a URL as a parameter and use the getResource() method of the class to get the URL to the Image:
    URL imageURL = getClass().getResource("images/fractions/image1.png");
    Image image = Toolkit.getDefaultToolkit().getImage(imageURL);See:
    http://java.sun.com/docs/books/tutorial/uiswing/misc/icon.html#getresource
    Jim S.

  • Cannot load .dll files in another directory when double clicking on the .exe

    Hi all,
    I am currently using VS 2005. I have quite a few of .dll(s) that is currently residing in the same directory as the .exe
    I want to put the .dll(s) in another directory and have the application point it to that directory so that it can load the .dll(s) from there. 
    I know that I am able to set the Environment path to my desired directory in project properties->debugging. 
    However, i also know that this is only applicable for debug mode and executing the app by pressing "F5" or the "play" button.
    But when i double click on the app in the debug folder, it does not load the .dll(s) from the specified path. 
    How can I make the .dll(s) load from my specified path even when i double click on the .exe? in debug and release mode. 
    Cheers,
    nat

    Hi Nat,
    Thank you for your information.
    Your issue is out of support range of VS General Question forum which mainly discusses
    the usage of Visual Studio IDE such as WPF & SL designer, Visual Studio Guidance Automation Toolkit, Developer Documentation and Help System
    and Visual Studio Editor.
    Because you want to load dlls from your application, it is more related to programming, I suggest opening a new thread about your issue in some development forums based on the type of your application. For example, if you are working with Windows Forms app,
    you can consult on Windows Forms Forum:http://social.msdn.microsoft.com/Forums/windows/en-US/home?category=windowsforms
    If you are working with WPF app, WPF forum is a proper forum:
    http://social.msdn.microsoft.com/Forums/vstudio/en-US/home?forum=wpf
    Best regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Static method to read text file within JAR.

    I've a small problem. I've got my JAR file stuff working great, so I thought I'd give a go to running it via WebStart. Through a little research, I've found that if you're distributing your application via WebStart, you need to pack up everything in a JAR file. This is no problem for the JDBC drivers, because its already in a JAR, so I should be able to distribute that fine.
    I've managed to digitally sign my application JAR and have a preliminary (i.e. untested) JNLP file set up.
    My problem is, my application gets its available data sources from an external text file. I've already written my own file I/O class which I use in my "commonfiles" package to read in a text file and return it as an array with each element holding a line from the text file. This class is basically just a bunch of static methods.
    So instead of rewriting this, I thought I'd just add a boolean flag to this method to state whether to load this file from the external file system or the JAR file. I've found out that to load a text file from within the JAR you have to use something like: -
    String str = (this.getClass().getResource("/myData.txt")).getFile();
    java.io.File fil = new java.io.File(str);
    java.io.FileReader fr = new java.io.FileReader (fil);
    java.io.BufferedReader bin = new java.io.BufferedReader (fr) ;The sticking point is that my method (ReturnFileAsArray()) is declared as static, because my own FileIO class is just a bunch of static methods to do file I/O stuff. Therefore, I can't use the above method because of the instance variable "this" (I assume).
    Is there any way I can load an included text file as above without having to declare my method as an instance method? I guess I could write a seperate class to do this for my commonfiles package, but I'd rather not if possible.
    Any ideas?

    Don't put a "flag" and code different ways to read files depending on whether it's in a JAR or not. Just use
    the getResource/getResourceAsStream API regardless. Hmmm.....so that will load it from either place depending on the situation? I keep getting a NullPointerException doing that, on this line: -
    String strFileName = (FileIO.class.getResource(fileName)).getFile();...although I've only tried it using the external local filesystem file (in the same directory) as I've not really finished setting up my WebStart stuff yet.
    Here is the method in question...
    public static String[] ReadFileAsArray(String dirName, String fileName, boolean bFromJAR) {
            String[] resultStringArray = null;
            StringBuffer strBuffer = null;
            StringTokenizer strTokenizer = null;
            FileReader fReader = null;
            BufferedReader bReader = null;
            int iElementCount = 0;
            if ((dirName.length() < 1) || (fileName.length() < 1)) {
                // Null parameters found. Failure.
                return null;
            } else {
                // Parameters correct, continue.
                try {
                    // Read the file contents and convert to String array.
                    //if (bFromJAR) {
                        // Open file from within JAR file.
                        String strFileName = (FileIO.class.getResource(fileName)).getFile();
                        File jarFile = new File(strFileName);
                        fReader = new FileReader(jarFile);
                    //} else {
                        // Open from local filesystem.
                    //    fReader = new FileReader(dirName + File.separator + fileName);
                    bReader = new BufferedReader(fReader);
                    strBuffer = new StringBuffer();
                    while (bReader.ready()) {
                        strBuffer.append(bReader.readLine() + "%%");
                    strTokenizer = new StringTokenizer(strBuffer.toString(), "%%");
                    resultStringArray = new String[strTokenizer.countTokens()];
                    while ((strTokenizer.hasMoreTokens()) && (iElementCount < resultStringArray.length)) {
                        resultStringArray[iElementCount++] = strTokenizer.nextToken();
                    bReader.close();
                    return resultStringArray;
                } catch (IOException e) {
                    return null;
        }I'm calling it using: -
    // Load the external file into a String array, one row for each element.
    String[] fileArray = FileIO.ReadFileAsArray(System.getProperty("user.dir"), "datasources.dat", true);Cheers on any info on this.

  • Double clicking jar executables

    Hi everyone
    I know that this topic has been discussed before - but I have scanned all discussions, and the problem hasn't been solved yet. There have been some good suggestions, but no definitive solution provided.
    I have a jar executable supplied to me by a commercial software company. The application is packaged in a jar file. I have checked that the manifest has the correct Main-Class association in it. I can install the jar on some Win 2000 copmuters and it executes fine by just double clicking on the jar file. On my laptop which also has Win 2000 OS it simply refuses to execute. The very frustrating JVM Launcher error message "Could not find main class. Program will exit." is displayed.
    The only way that I have found to get around it is to put a batch file in the same directory as the jar file containing "start /MAX javaw -jar "C:\Program Files\EqWave\eqwave181\eqwave.jar"" and execute this batch file from a shortcut placed on the desktop. Not a very good work-round - but at least it works.
    What I can't figure out is why the jar will work when double clicked on some computers, but not on my laptop. Obviously it has something to do with my laptop setup.I have reinstalled the latest jre-1_5_0-windows-i586.exe, but it still won't work.
    Please, please, pretty please - what am I doing wrong?????
    Cheers
    Mike T

    On your laptop the file association could be wrong : check if the file association with .jar is "javaw -jar" and not only "javaw".
    It looks like the "-jar" option is missing in the command field of your file association...
    On my Windows 2000 computer, the file association for .jar is :
    "C:\Program Files\Java\j2re1.4.1\bin\javaw.exe" -jar "%1" %*Modify your file association and I bet it will be better.

  • JNA loading DLL UnsatisfiedLinkError

    Dear JNA enthusiasts,
    I read this article
    http://today.java.net/pub/a/today/2009/05/19/protect-your-legacy-code-jna.html?page=last#thread
    and tried to run the code (code.zip, it's at the bottom of the article)
    Keep getting:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'nativecode': This application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem.
    I tried:
    java HelloWorld (as he suggested)
    java -Djna.library.path=. -cp .;jna.jar HelloWorld
    ...same effect
    Tried running in Eclipse, loaded DLL as System.load("c:/tmp/nativecode.dll") in main()
    ...doesn't work
    I would greatly appreciate if someone could tell me what am I doing wrong...
    Thanks
    Vadim

    Presumably you meant the following link
    [http://today.java.net/pub/a/today/2009/05/19/protect-your-legacy-code-jna.html]

  • How to know which class is being loaded from which jar file & path location

    Hi,
    I have some Java code using several jar files.
    I want to remove those jar files which are not being used by the code.
    So , I want the JVM to output which class is being loaded from which jar .
    Using "java -verbose" option doesnt solve the problem because the required info is printed only for the classes/jars native to the J2SE package .
    Can anyone provide a solution which does not require me to modify the code?
    Thanks,
    Danish

    Classpath Helper

Maybe you are looking for

  • How can I delete items in trash from an external hard drive?

    I have a Macbook Pro and have installed Paragon so that I can use an external hard drive on both my Mac and my PC.  But some files I deleted from my external hard drive (Seagate 3TB) while on my Mac can't be deleted from the recycle bin. When I try t

  • Offsetting Field for Liquidity Forecast Report (FF7A)

    Hi Expert, Would you like to suggest what BtE that can be used to display offsetting account in Liquidity Forecast Report for Customer and Vendor ? We have implemented BtE "SAMPLE_INTERFACE_00002218", the BtE works fine in the Cash Position Report fo

  • How to add F4 help for the custom field of a custom table

    Hi All, How to add F4 help to the custom table field? in the table maintainance when user clicks on F4 i want to provide possible values for this field I am trying to write the code in the screen of table maintainace like the following PROCESS ON VAL

  • How to get a USB-Serial connector working

    I have a laptop with only USB ports, I'm trying to get a USB Serial connector working. I can't find a good guide on how to do it, I can figure out that i need to enable some sort of kernel options, but I'm not sure about how to go about doing it. Can

  • Array loop - assigning variables

    Hi All, This is similar to a question I previously had, (which kglad so kindly helped me with) so please bare with me. Here is the code: nor = Array(a, b, c); aVar = Array(); aVar[0] = 0; aVar[1] = 0; aVar[2] = 0; for (i=0; i<nor.length; i++) nor[i].