How to load externally libraries on a java application

Hi,
I've created a java application which i've compiled as an executable file. I want to cut the size of the exe down, and so i'm trying to load some libraries externally, instead of the IDE including it on the executable i created. So basically i've got my application.exe file, and in the same directory i have an images directory and a lib directory. How do i access the jar files on the lib directory? Some examples of code would be great. At the moment my lib directory contains mssql.jar files.
thanks

no it hasn't bundled the jvm into the app. the app is 438kb without the jar libs included. The libs add another 400+kb . i've separated the image files without problems. This loads the images from a directory called images. The issue is just how load the libs.

Similar Messages

  • How to load word .doc-files into java applications?

    Hi,
    I want to load a word .doc-file (or any other type of document) into a java application, as part of the application.
    Is there any java special library to do it?
    Any solution or hint?
    Thank you.

    No, there is no existing Java library to do it that I am aware of. You could write your own, however, as the Word 97 binary file format is published. I am not sure that the Word 2000, or XP formats are as well, but since they put out the 97 presumably they'd do the same with the rest -- although I am suprised that Micro$$$oft even published the 97 format.
    A library such as this would take quite some time write, due to the extensive format, but here's a link to a copy of it just so you can see what it'd take: http://www.redbrick.dcu.ie/~bob/Tech/wword8.html
    Also keep in mind that Micro$$$oft has never remained binary compatable between versions. In short, this means that you'd have to parse each version's documents differently. Not a fun task.
    If a Java library to read Micro$$$oft file formats already does exist, I'm willing to bet that it costs $$$ mucho dinero $$$.
    Hey, aren't proprietary file formats just wonderful?

  • Linux JVM: How to load shared libraries with mutual/circular dependencies

    Hi,
    I am using the API
    System.loadLibrary(String name)
    to dynamically link shared libaries to Linux JVM.
    The shared libraries has complex circular symbol dependencies among them.
    I am not able to load shared libraries due to java.lang.UnsatisfiedLinkError.
    Any ideas on how a number of shared libraries with interdependent realtionships
    could be successfully linked in to the Linux JVM?
    Thanks,
    Soumen.
    Background
    ===========
    Successful execution of native code within Java virtual machine in a
    host platform, has two necessary prerequisites:
    Prerequisite 1: The native code is written to the JNI specification
    Prerequisite 2: The native code is dynamically linked with Java virtual
    machine.
    The second step is achieved via simple Java interface, System.loadLibrary:
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/System.html#loadLibrary(java.lang.String)
    However, implementation of this interface is highly platform dependent
    in regards to exact nature of dynamic linking process.
    Tests
    =====
    I made three shared libraries libfeatureA.so, libfeatureB.so and libfeatureC.so.
    Feature A and Feature B are mutually dependent on each other (i.e cicular
    dependencies between libfeatureA.so, libfeatureB.so) whereas libfeatureC.so
    has no external dependencies.
    Case 1
    I could link libfeatureC.so with java.
    Case 2
    Java failed to resolve circular dependency between libfeatureA.so, libfeatureB.so
    resulting in linking failure. There may be repackaging workarounds which I have
    not yet explored.
    Java source code
    ================
    class TestLoadLibrary
    static
    System.loadLibrary("featureB");
    System.loadLibrary("featureA");
    System.loadLibrary("featureB");
    public static void main(String[] args)
    System.out.println("In TestLoadLibrary.main()");
    Exception in thread "main" java.lang.UnsatisfiedLinkError: /homes/soumen/work/event/featureB/libfeatureB.so.1.0: /homes/soumen/work/ev B.so.1.0: undefined symbol: featureA_func2
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1737)
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1662)
    at java.lang.Runtime.loadLibrary0(Runtime.java:817)
    at java.lang.System.loadLibrary(System.java:986)
    at TestLoadLibrary.<clinit>(TestLoadLibrary.java:5)

    The use of "dlopen() application programming" to achieve dynamic link closure works if there are
    no circular dependencies. For example, I have the following dependency:
    libfeatureD.so ==> libfeatureC.so
    Even if I call Java APIs in correct dependency order, i.e.,
    System.loadLibrary("featureC");
    System.loadLibrary("featureD");
    there would be java.lang.UnsatisfiedLinkError for call System.loadLibrary("featureD").
    Now, I have a JNI method implementation, which makes native API call in same dependency order:
    dlopen("libfeatureC.so", RTLD_LAZY|RTLD_GLOBAL);
    dlopen("libfeatureD.so", RTLD_LAZY|RTLD_GLOBAL);
    and now System.loadLibrary calls succeed. Note that I had to set environment
    variable LD_LIBRARY_PATH so that dlopen call would find libraries to load.
    In other words, from a JNI programming point of view, "linking chasm" has been crossed.
    I am looking at circular dependency issue, i.e.,
    libfeatureA.so <==> libfeatureB.so
    There may be library repackaging workaround.
    If anybody knows any workaround, please post.
    -Soumen Sarkar
    JNI code
    ========
    #include <jni.h>
    #include "TestLoadLibrary.h"
    #include <stdio.h>
    #include <string.h>
    #include <dlfcn.h>
    JNIEXPORT void JNICALL Java_TestLoadLibrary_libLoadNative
    (JNIEnv * jenv, jclass class, jobjectArray libNames)
    printf("native: In TestLoadLibrary.libLoadNative()\n");
    char linuxLibName[1024];
    jsize idx = 0;
    jsize nLibs = (*jenv)->GetArrayLength(jenv, libNames);
    for(idx = 0; idx < nLibs; ++idx)
    /* obtain the current object from the object array */
    jobject myObject = (*jenv)->GetObjectArrayElement(jenv, libNames, idx);
    /* Convert the object just obtained into a String */
    const char libName = (jenv)->GetStringUTFChars(jenv,myObject,0);
    strcpy(linuxLibName, "lib");
    strcat(linuxLibName, libName);
    strcat(linuxLibName, ".so");
    printf("\nnative: Trying to open lib with name %s\n", linuxLibName);
    void* handle = dlopen(linuxLibName, RTLD_LAZY|RTLD_GLOBAL);
    if(handle == 0)
    fputs ("\nnative: Could not load lib\n", stderr);
    fputs (dlerror(), stderr);
    else
    printf("\nnative: Loaded lib %s\n", linuxLibName);
    /* Free up memory to prevent memory leaks */
    (*jenv)->ReleaseStringUTFChars(jenv, myObject, libName);
    return;

  • How to use external libraries jar files in the composite application?

    Hi,
    I have some external jars files (which consists of java classes) that I would like to use in my composite application. 
    I have created a DC with type as external library for the jars.  However, I don't know how to specify the DC to be used in my caf application.
    Can anyone help?
    Thanks.
    Regards,
    Fui Voon

    Hi,
    My jar files consists only java classes and a manifest.mf. The files are compiled using jdk 1.4.2-b28.  Will this be any issue?
    It seems that if I ignore the error and continue step 7 which is to do deployment of the ear, the error given is
    Cannot update it.
    Caused by: com.sap.engine.library.bytecode.cf.CFException: Invalid constant pool tag, 60 at index 41.
    Does anyone know what that mean?
    Is there any sample that teach how to deploy external libraries as bundled library?
    Thanks.
    Regards,
    Fui Voon

  • How to load external storage html file in web view

    hi all,
        how to load external storage html file in web view, please help me
       " ms-appdata://local/index.html" not working
    veerasuthan veerakesan

    It need be read as string. Then load the string by  Webview.NavigateToString.
    Sample as below
    string htmlstring = string.Empty;
    try
    var htmlfile = await Windows.Storage.ApplicationData.Current.LocalFolder.OpenStreamForReadAsync("a.html");
    using (System.IO.StreamReader streamReader = new System.IO.StreamReader(htmlfile))
    htmlstring = streamReader.ReadToEnd();
    webview.NavigateToString(htmlstring);
    catch(Exception ex)
    Debug.WriteLine(ex.ToString());
    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

  • Using external libraries over signed Java applet: InvocationTargetException when running locally with 7u51

    We have a signed Java applet that uses external libraries, specifically the OpenOffice application libraries.
    We have a problem running Java applet with 7u51 of "InvocationTargetException" when use these libraries OpenOffice, that is not signed; regardless of the browser used (Mozilla Firefox, Explorer, Chrome).
    Please, as you could solve this problem?   This problem can not arose with 7u40 and earlier..
    Best regards.

    In  java - JRE 1.7.0_51-b13 and signed applet - Stack Overflow found solution. I've missed to add in external jars manifest this: 
    Trusted-Library: true

  • How to create a Batch file for java application  ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    [http://static.springsource.org/spring-batch/]
    Assuming you want to develop a batch application rather than actually just create a .bat file ..

  • HOw to create a Batch file for java application and whats the use of this ?

    HI,
    How to create a Batch file for java application ?
    And whats the use of creating batch file ?
    Thanks in advance

    First of all, you're OT.
    Second, you can find this everywhere in the net.
    If you got a manifest declaring main class (an classpath if needed), just create a file named whatever.bat, within same directory of jar file, containing:
    javaw -jar ./WhateverTheNameOfYourJarIs.jar %*By the way, assuming a Windows OS, you can just double click the jar file (no batch is needed).
    Otherwise use:
    javaw -cp listOfJarsAndDirectoriesSeparedBySemiColon country/company/application/package/className %*Where 'country/company/application/package/' just stands for a package path using '/' as separator instead of '.'
    Don't specify the .class extension.
    Javaw only works on Windows (you asked for batch, I assumed .BAT, no .sh), in Linux please use java.exe (path may be needed, Windows doesn't need it 'cause java's executables are copied to system32 folder in order to be always available, see PATH environment variable if you don't know what I'm talking about) and use ':' as classpath (cp) separator.
    The '%***' tail is there in order to pass all parameters, it only works on Windows, refer to your shell docs for other OSs (something like $* may work).
    This way you have a command you can call to launch your code (instead of opening NetBeans just to see your app working). You could schedule tasks on it or just call it in any command prompt (hope you know what it is 'cause there have been people in this very same forum with no clue about it, if not just hold the 'Windows button' and press 'R', then type 'cmd' and run it).
    Finally add dukes and give 'hem away.
    Bye.

  • How to deploy a POJO or a java application in oracle ESB?

    hi,
    I m beginner in oracle ESB.
    please someone tell me how to deploy a POJO or a java application in oracle ESB?
    thank you.
    Peter.

    The short answer is "you wouldn't"
    The long answer is that you would expose your Java Application or POJO as a Web Service then virtualise it through the ESB.
    If you're wanting to learn more about SOA, ESB and BPEL have you been to this site http://download.oracle.com/docs/cd/B31017_01/index.htm

  • How to assign the Thems into Webdynpro Java Application

    HI All,
                   I Downloaded the plugin for them editor and i add those plugins and i created the Them. Please any one can help me how to add that Them into Webdynpro java application.

    Hi ep bhargav,
    You can check this link.....
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/ccb6bcf4-0401-0010-e3bc-ec0ef03e13d1
    Re: webdynpro theme editor
    Thanks.
    Venkat.

  • How to import the image by using java application

    1.how to import the image by using java APPLICATION and display it on the textarea that you have been created.
    2.how to store the image into the file.
    3. what class should i used?
    4. how to create an object to keep track the image in java application.
    * important : not java applet.
    plzzzzzzz.
    regards fenny

    follow the link:
    http://java.sun.com/docs/books/tutorial/2d/images/index.html

  • How to create the exe files for java application

    How to create the exe file for java application?
    got any software to do that?
    Thanks

    In terms of converting java applications into exe files, there are 3 schools of thought:
    1) Instead of converting it to an exe, convert it to a jar file. Jar files are more portable than exe files because they can be double-clicked on any operating system. The caveat is that a Java interpreter must be installed on the target computer for the double-clicking to work.
    http://developer.java.sun.com/developer/Books/javaprogramming/JAR/
    2) Create an exe launcher that, when double-clicked, attempts to find a Java interpreter on the local computer and launches the Java application. The exe file is still double-clickable but whether your java application runs depends on whether a Java interpretor is installed on the target computer.
    http://www.sureshotsoftware.com/exej/
    http://www.objects.com.au/products/jstart/index.jsp
    http://www.duckware.com/products/javatools.html
    http://www.ucware.com/jexec/
    http://www.rolemaker.dk/nonRoleMaker/javalauncher/
    http://www.jelude.cjb.net/
    http://thor.prohosting.com/~dfolly/java/index.html
    3) Create an exe launcher that bundles a Java interpretor. Same as above but when the exe file is double-clicked, it searches for a Java interpreter and if one is not found, it installs one on the target computer. The caveat is that the exe file would have an overhead of 10 MB in size for the interpreter.
    http://www.excelsior-usa.com/jet.html (evaluation version available)
    4) Convert the Java application into a native exe file. The caveat is that if you use Swing for your GUI, it won't be converted. Also this option is still somewhat experimental.
    Can't think of any free options right now.

  • Can anybody tell me how to send/receive  the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    Which jsms? Google finds several.
    Try the website where you downloaded it.

  • Can any body tell me, how to send/receive the sms from java application

    Hi All,
    Can any body tell me, how to send/receive the sms from java application to mobile phones.
    I have installed the jsms engine and when i try to connect to the mobile device ,the jsms server is giving
    the following error.
    Cannot connect to GSM Device, error : -11

    The best place to ask your question is at the JSMS website, forum or mailing list since this is no error that directly comes from a class belonging to the core Java classes.

  • How to load external resources such as JavaScript files, etc. ?

    Hello,
    I'd like to put my resources files such as my scripts, my stylesheets, in a jar file, included in my webapp.
    How can I refer to these files in my JSP file ?
    Should I make a filter ?
    Can someone help me please ?
    Thanks in advance.
    bgOnline

    using loadjava I can load commons-net-ftp-2.0.jar and my jar. When i execute pl/sql wrapper for defined java stored procedure it results into exception.
    retval=-29532;ORA-29532: Java call terminated by uncaught Java exception: java.lang.NullPointerException
    Same code works as Java application. I also granted socket permissions
    DBMS_JAVA.GRANT_PERMISSION(
    'SCHEMANAME', 'java.net.SocketPermission', REPLACEWITHHOST||':'|| REPLACEWITHPORT, 'connect,resolve');
    This did not resolve the error. Since i do not have control external java library and it works as standalone application....
    do you know any workarounds? Any ideas on implementing FTP functionality in plsql on oracle 11g database?
    Thanks
    Madan
    Edited by: MadanShah on Aug 8, 2009 11:15 AM

Maybe you are looking for

  • Re creation of database index

    suppose while updation of database, some of the index are not re created at the database level.. some bug in the backend(oracle) i guess.. can we diagnose this thrugh ABAP, i mean can we check if any index has not been recreated in database table upd

  • How to display data in a table on the screen

    Dear members, I have to display data from the database in a table on my screen when the page loads. I have created the VO and the AM and made the mappings for the columns i want to display but the table on my screen is not fed when the page loads. I

  • Trying to make sense of AS2 gradient fill matrices

    This one will likely interest kglad, but I'm all ears for insight from anyone who digs math. I've been working with gradient fills lately in AS2, which means I've been reading through related entries in the ActionScript 2.0 Language Reference. Here's

  • Issues with different versions of Oracle.DataAccess.dll

    I have a .net web service application which references version 10.2.0.100 of Oracle.DataAccess.dll. A client has setup Oracle 10g database on the server, but I think the server has a patch set installed so it appears that the versions of Oracle.DataA

  • How can I grab NT username from a jsp page?

    I have a requirement to grab the user's NT username using a jsp page. I thought about using JAAS NT module samples, but I would need an application running on the client to do this (not a webpage). Then I thought about using an applet, but then read