How to include another .jar package in an applet jar package

Hi, I'm using Eclipse to write an applet which needs some other .jar packages to support it. I add them as external jar package in project properties. In eclipse, everything works fine when I compile and run. But I when export the applet to .jar and try to run in browser, it doesnt work.
I think probably because I didnt export the packages that the applet requires to run. However I cant find a way to export these packages together with the applet to a final .jar file.
Anyone knows how to solve this ? plz help. thx you in advance

Hi, I'm using Eclipse to write an applet which needs
some other .jar packages to support it. I add them as
external jar package in project properties. In
eclipse, everything works fine when I compile and
run. But I when export the applet to .jar and try to
run in browser, it doesn't work.
I think probably because I didn't export the packages
that the applet requires to run. However I cant find
a way to export these packages together with the
applet to a final .jar file.
Anyone knows how to solve this ? plz help. thx you in
advanceHi all,
I have been having the same problems too but came to realize that it is quite difficult getting your applet to work in most cases when using external jars. I found out thet you will have to create the directory hierarchy with the necessary imported classes used by your applet. and then create a new jar file that you will use in the codebase tag.
For example:
/* Java code snippet */
import org.apache.XmlRpcClient;
public MyApplet extends JApplet {
//..... Rest of your code ......
}/* End of snippet */
You would then have to create a the directory structure:
org
_apache
___xmlrpc
Then place all the required classes imported from within (Sometimes it is easier to just add all the classes to save time but lose space i.e. larger jar files).
Execute the jar command (please adjust as needed to your requirements):
jar cvf any_name.jar *.class org/
After signing the applet it may solve your problem. Since I'm working with XmlRpc I still have a lot of problems. If anyone has any advice or tips, please share.
Thank you

Similar Messages

  • How to include the mysql-connector in a simple .jar file

    Well I started up with java again. Just messing around. This project I'm making now is just plain simple, I have a program thats going to read a table in a database from a server I have here at home. It works fine if I do like this: java javafil to run the file, it reads from the database fine.
    But when I made a .jar file out of it using this command: jar cmf manifest.txt javafile.jar *.class
    It won't connect to the database. Or it doesn't print out the rows in the table. So I thought I have to include the mysql-connector with the .jar.
    manifest.txt
    Main-Class: javafile
    Now what is an easy way to do this?
    This program is also going to be run from a computer that might not have the mysql-connector installed on the computer. Like a friend of mine wants to connect to the database and read it.
    I've tried to google "mysql connector in a .jar file" but I get tons of informations about the mysql-connector.jar instead of what I'm looking for.
    Thanks,
    Torbj�rn Svae
    Edited by: LordSvae on 19.jun.2008 14:52

    LordSvae wrote:
    Yeah but the other computer might not have that connector file on their computer. So is there like I way I can use it when it is in the .jar file? Thats kinda what I wanted. You cannot include another JAR in a JAR file. You however can extract it and put the classes in your JAR. Verify the license agreement if it is allowed. Although this is considered as a bad practice (poor upgradebility and maintainability).
    If you don't want to use the -cp parameter, then use the class-path entry of the manifest.mf of your JAR. You can also write a batch file with the whole JAR -cp command in a single line and run the batch file instead.
    Pluss, even though I have the right classpath in the environment variables set, it doesn't work for me either. So I guess it doesn't load the connector when running the .jar file.The classpath environment variable has nothing to do with running JAR's. Forget about it and use the -cp or -classpath parameter.

  • How to include another msi with LV application builder?

    I can use LV application builder to create an installer for my application. But my application relies on a 3rd part msi, which should be run after my application is installed.  So how to include this msi with LV app builder? Thanks in advance.

    I would recommend executing a batch file that launches your other installers after your LabVIEW executable finishes installing. The process of doing this (in addition to other suggestions about including 3rd party installers) can be found in the Knowledgebase linked here.
    Kind Regards,
    E. Sulzer
    Applications Engineer
    National Instruments

  • How to include a JSP page contained in a JAR file ?

    Hello,
    I have a Servlet in which I would like to include, in the Response, the content of a JSP page contained in an external JAR file included in my lib directory ?
    Could someone help me please ?
    Thanks in advance.
    bgOnline

    I don't think thats possible with the standard j2ee server.
    There are probably ways around it, but it would involve a large component of custom coding.

  • How to include another partition in tape backup

    Hi
    I use a shell script written by my sysadmin to take backup of our oracle system on tape. now i moved some datafiles on another partition and hence want to include that partition also in tape backup.
    for fs in $(cat /tmp/dailybkupfs | awk '{print $1}')
    do
    # For / replace the / with root for log filename
    if [[ "$fs"  = "/" ]]
    then
    fn="root"
    else
    # replace any / in fs name with _ for use in log filename
    fn=$(echo $fs | sed 's:/::g')
    fi
    if umount ${fs}
    then
    echo "${fs} unmounted successfully" >>/tmp/logs/summary
    else
    echo "${fs} unmount failed" >>/tmp/logs/summary
    fi
    if ufsdump 0uf prddb:/dev/rmt/0n ${fs} >${log}.${fn}.${dt} 2>&1
    then
    echo "Full Backup of ${fs} completed successfully" >> /tmp/logs/summary
    else
    echo "Full Backup of ${fs} failed" >> /tmp/logs/summary
    fi
    if mount ${fs}
    then
    echo "${fs} mounted successfully" >>/tmp/logs/summary
    else
    echo "${fs} mount failed" >>/tmp/logs/summary
    fi
    done
    echo "Full Backup of all DB file systems Complete" >> /tmp/logs/summary
    Also the dailybkupfs file has the following contents->
    /u01
    /u02
    /u03
    /u04
    /u05
    /u06
    Now to include /u07 partition for backup, I just need to include the /u07 partition in file dailybkupfs.right?
    Thanks
    Anmol

    I am concerned that the config file resides in /tmp.
    That filesystem normally gets cleared if the box reboots.
    So as far as I can tell, if your box is rebooted, the backups stop working..

  • How to include a large amount of objects in a package interface

    Hi guys,
    I would like to include a large amount of objects (programs, classes, etc.) in a package interface in the package builder (SE21).
    I would like to avoid inserting them one by one. Is anyone have a solution? It is not possible to use such characters has " * ". There is no documentation or help provided for this issue.
    Thank you in advance for your answers.
    Best regards,
    Sylvain

    Hello,
    I do not wish to change the package assignment of all my objects.
    I created a new package in which I created an interface to include various objects from others packages (standard and customer specific). I want to make these objects visible into my new package.
    Since I have a high quantity of objects to include in my interface, I would have like to know if there was a simple way to do this task rather than entering the name one by one in SE21.
    I hope the context is clearer now.
    Best regards,
    Sylvain

  • How to "include" another page or servlet in a standard servlet

    How can I achieve a "include" in a servlet?
    From what I see... the include() method is on the PageContext class, which is in org.apache.somewhere... right??
    Or am I missing something?
    thanks

    How can I achieve a "include" in a servlet?
    From what I see... the include() method is on the
    PageContext class, which is in org.apache.somewhere...
    right??
    Or am I missing something?
    thankshttp://java.sun.com/webservices/docs/1.0/api/javax/servlet/RequestDispatcher.html#include(javax.servlet.ServletRequest,%20javax.servlet.ServletResponse)

  • How can I run jasperreports-0.6.8-applet.jar?

    Hi all,
    I'm trying to run the jasper's jar files.
    Do I need to run it to have a graphical interface ?

    Have you figured this out yet? I need the same question answered.

  • How to include a main window in sapscript

    hi all ,
        i just create a sapscript , and i found on sap online help that i could include main window up to 99 times ,  but i don't know how to include another main window.
    regards

    Hi Kevin,
    first Goto T-code SE71 create one test script in that design the layout in the normal method once your design is complete than there one option called EDIT
    in that EDIT-> window>creat-> vraible
                                                          main
    select the option main window placed this window according to u r requriment it will displayed as per logic.
    one imporatant point whn u place scond main window it take diffrent higt but it will not take differnt width so u can place scond main wiindow with differnt hight but not not in width.
    reward is usefull.
    thanks.

  • How to run applet within packages in tomcat

    I have servlet packages and applet packages in my application. I can successfully called my servlet packages by using:
    http://localhost/servlet/mypackage1.mypackage2.myServlet
    However, I can't call my applet packages by using:
    http://localhost/myapplet.html
    <Applet
    CODE = "myApplet.class"
    BASECODE = "mypackage1.mypackage2/"
    </Applet>
    I am currently using tomcat default web services directory structure as follows:
    webapps\ROOT\WEB-INF\classes\mypackage1\mypackage2\myServlet.class
    webapps\ROOT\mypackage1\mypackage2\myApplet.class
    I received the following error:
    noClassDefFoundError:myApplet (wrongname: mypackage1\mypackage2\myApplet)
    Thanks in advance for any helps.

    This doesn't have anything do with servlets. Your
    problem, as you said, is how to write the HTML to run
    an applet. Whatever is trying to load that HTML
    doesn't know anything about your servlets and doesn't
    care. I think it is complaining because you did or
    didn't put your applet in the (badly-named) package
    mypackage1.mypackage2.The package names I used was just an example. My real package names were really long and 10 levels deep so I didn't want to use it. I finally figured out how to tell the browser to find my applet class package. Using my original example (with the bad package names):
    <Applet
    CODE = "mypackage1.mypackage2/myApplet.class"
    </Applet>
    I removed the codebase and just put the package class file in the root directory.
    I am sure there are more than one way to make this thing work but this is how I got my to work. Thanks.

  • How to Include libraries (Jar's/Packages/ClassNotFoundException/Classpath)

    Ive spent hours looking for a solution, So maby i making a simple human error which i cant find.
    Im unfamiliar with using packages.
    I have created a program that use the JDBC libary. However i need to distribute this program and keep getting a ClassNotFoundException which is throw by:
    String s = "com.mysql.jdbc.Driver";
    Class.forName(s);I would like to have the "mysql-connector-java-bin.jar" file inside my main jar file However I think this may be very complex so i assume it would be easier to have it in the same directory as the main jar file.
    I create my main jar file with:
    jar cmf mainClass.txt Main.jar *.class mysql-connector-java-bin.jarI also jarsigner but i wouldn't expect this to case this problem.
    mainClass.txt
    Main-Class: MyClassFile
    Class-Path: mysql-connector-java-bin.jar
    Sealed: trueAny ideas what im doing wrong? or How i could solve this problem?
    Do i need to write a program which installs the JDBC on their system?
    Is there an easy solution?
    Any advice would be greatly appriacted.
    Thanks,

    ty for the reply
    I now create my jar file with:
    jar cmf mainClass.txt Main.jar *.classand the "mysql-connector-java-bin.jar" is still in same directory as my main.jar file
    Ive also replaced the "mysql-connector-java-bin.jar" to make sure it hasnt been corrupted somehow.
    However i still get the same error.
    the stackTrace is:
    java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            at java.lang.Class.forName0(Native Method)
            at java.lang.Class.forName(Unknown Source)
            at SQLConnection.<init>(SQLConnection.java:18)SQLConnection a class i have created.and the lines 17 and 18 are posted in my first post.
    Anyideas?

  • How to include md5 package in application

    Hi All,
    First of all sorry I posted in another users thread. In the thread http://forums.sun.com/thread.jspa?threadID=5426671 the person used org.bouncycastle.crypto.digests.MD5Digest for doing md5.
    I need some help here on how you include the org.bouncycastle.crypto.digests.MD5Digest library in my java code as I want to use the md5.
    I am also working on something similar like that but without the web application part and a detail which consists on OTP part using md5.
    As the md5() doesn't work in j2me so was also searching for something which will work on MIDP.
    package com.abc; //package define
    public class messDig5 //class define
        private String generateHash(String OTP, int loopNum) {
            byte[] secretBytes = OTP.getBytes();
            for (int x = 0; x < loopNum; x++) {
                byte[] tempStore = new byte[16];
                tempStore = hash(secretBytes);
                secretBytes = tempStore;
         //   return convertToHex(secretBytes);
            return byteArrayToHexString(secretBytes);
        public byte[] hash(byte[] secretBytes) {
           org.bouncycastle.crypto.digests.MD5Digest digest = new org.bouncycastle.crypto.digests.MD5Digest();
            digest.reset();
            // Update MD5 digest with user secret in byte format
            digest.update(secretBytes, 0, secretBytes.length);
            // get length of digest to initialise new md5 byte array
            int length = digest.getDigestSize();
            // create md5 byte array using length
            byte[] md5 = new byte[length];
            // calculate MD5 hash, using md5 byte array, 0 for buffer offset
            digest.doFinal(md5, 0);
            return md5;
    //    private static String convertToHex(byte[] data) {
    //        StringBuffer buf = new StringBuffer();
    //        String Hex;
    //        String formattedHex;
    //        for (int i = 0; i < data.length; i++) {
    //            int halfbyte = (data[i] >>> 4) & 0x0F;
    //            int two_halfs = 0;
    //            do {
    //                if ((0 <= halfbyte) && (halfbyte <= 9)) {
    //                    buf.append((char) ('0' + halfbyte));
    //                } else {
    //                    buf.append((char) ('a' + (halfbyte - 10)));
    //                halfbyte = data[i] & 0x0F;
    //            } while (two_halfs++ < 1);
    //        Hex = buf.toString();
    //        formattedHex = "\n" + Hex.substring(0, 4) + " " + Hex.substring(4, 8) + " " + Hex.substring(8, 12) + " " + Hex.substring(12, 16) + " " + Hex.substring(16, 20) + " " + Hex.substring(20, 24) + " " + Hex.substring(24, 28) + " " + Hex.substring(28, 32);
    //        return formattedHex;
        static String byteArrayToHexString(byte byteValues[]) {
            byte singleChar = 0;
            if (byteValues == null || byteValues.length <= 0) {
                return null;
            String entries[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
                "a", "b", "c", "d", "e", "f"};
            StringBuffer out = new StringBuffer(byteValues.length * 2);
            for (int i = 0; i < byteValues.length; i++) {
                singleChar = (byte) (byteValues[i] & 0xF0);
                singleChar = (byte) (singleChar >>> 4);
                // shift the bits down
                singleChar = (byte) (singleChar & 0x0F);
                out.append(entries[(int) singleChar]);
                singleChar = (byte) (byteValues[i] & 0x0F);
                out.append(entries[(int) singleChar]);
            String rslt = new String(out);
            return rslt;

    Camellia,
    I take you already added bouncycatsle to your project as a compile dependency, since it compiles (unless it does not).
    All you have to do for your code to work on the phone, you need to build your JAR file (that you use to distribute your MIDlet) with bouncycastle packaged in. This will all depend on the method you use to build your JAD and JAR files.
    I use antenna tool, which provides me with ant tasks to compile, build jar, package external libraries etc. Your scenario can be different, but all you have to do is to search manuals and/or google for methods on how to package external libraries with your build.
    Daniel

  • How to include package

    sir
    i m running an mil application and i have an error in import javax.mail.*
    statement.that package does not exist
    how to include it in path.........
    plz help me out
    thank you
    gaurav

    hi,
    u need to have two jars,namely,mail.jar and activation.jar in your classpath
    to use the javamail apis.hope this is of any help
    bye,

  • How to include a .js file into .jsp file.[.js file resides in a package]

    Hi,
    How do i include an external .js(JavaScript) file into a JSP file?My .js file is located in some package(lets say abc.jar). Below is my application structure:-
      jsp
       |
       ->MyJsp.jsp
      lib
       |
       |
    abc.jar
        |
        |
        ->com.abc.test
                     |
                     |
                     ->Test.java
                     ->abc.jsHow do i include "abc.js" file in "MyJsp.jsp" file?
    Please help.
    Thanks,
    Kiran
    Edited by: Adimulam on Jun 2, 2008 1:22 PM

    Even this is also not possible because, the code in that package is developed by DWR and i am just adding it to my lib folder and importing the respective classes. In the same manner i need to include the *.js* file in the JSP.It took me about 3 minutes reading through the [DWR Getting Started|http://getahead.org/dwr/getstarted] page to learn that you don't have to do any of that. Perhaps you should read that page?

  • How to include third party .jar files into my jar file

    Hi,
    how do i include a open source third party jar file into an executable jar?
    i have a class called BlogBox.java and it uses org.apache.commons.net.ftp.FTPClient, i want to create an executable file, where do i put the .jar file containing FTPClient aka Apache Commons Net?
    currently i'm getting the following error from when executing my BlogBox.jar
    C:\MyJava\BlogBox>java -jar BlogBox.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
    at blogbox.BlogBox.<init>(BlogBox.java:27)
    at blogbox.BlogBox.main(BlogBox.java:103)
    Any suggestions? i have searched google and this forum but could not find the solution to my problem, thanks
    [edited msg] do i need to add the classpath at execution or something of the apache commons net library?
    Message was edited by:
    gekkokid

    When you use an executable jar the normal class path
    is ignored, but you can put a classpath inside the
    jar. The usual trick is to place the library jar
    files in a directory inside the application directory
    and direct the manifest file to it. The manifest file
    live in the jar inside the META-INF directory and
    it's called manifest.mf
    The two heavilly used entries are Main-class: and
    Class-path: lines. Class-path just has a
    comma-separated list of library paths.
    The jar utility has a special option to load it up.Thanks :) I created a "/lib" directory, placed in the packages in there and redirected the Class-Path: lib/commons-net-1.4.1.jar
    and it works,
    thank you everyone :)

Maybe you are looking for

  • New User Help Needed Formatting External HD in MS-DOS for PC file migration

    I have files on my PC and planned on putting them on a new external HD to transfer to the iMac. I have a new MiniStack V3 external HD with USB and Firewire connections. It comes formatted for the Mac. I want to format the HD on the iMac to MS-DOS so

  • Re: does anyone understand this stuff?

    I have a download speed is normaly 74 mbts donload and 20mbts upload My problem I can not make bt understand is that over the last 3 weeks the wierless speed has gone from 40 mbt anyware in the house to 0mbt most of the day even if I put my lap top u

  • Please help, thank you in advance!!!

    I downloaded some Podcast files then I changed their genre as Podcast... now those files disappear under my iPod main menu "Podcast" unless when I go to Music -> Genre -> Podcast, so how can I change them back as Podcast files not Music files. If any

  • How do get rid of maverick

    the more i think about it Lion was perfection this maverick thing is lousy. slower spell check no longer there ..the look of things is different. i want lion back...that was perfect!

  • Why no mention of the stop button on mp3 playe

    im from the old scholl, belt and braces etc... bought this new mp3 thingy (zen touch) lovely bit of kit, 20mb and only ?25 dosnt bother me its like a brick, im a bit big myself! played with it and and got ,000 songs on it, absolutley smashing only on