How to handle 2 or more .jar files with an applet

Hey out there
I have created an ftpClient application that uses "jakarta ftpClient". It works fine as an JFrame application � But when I converted the Application into an JApplet I get the following Exception:
java.lang.NoClassDefFoundError: org/apache/commons/net/ftp/FTPClient
I have bundled the main application into a .jar file (Application,jar). But I don't know how to handle the 2 jakarta .jar files with my JApplet??
I Tried to append the 2 jakarta .jar files to the Application,jar with the following code:
jar cvf Application.jar 1.class 2.class�. commons-net-1.4.1.jar jakarta-oro-2.0.8.jar
But with the same result / Exception (I have signed the Jar file!)
Can anyone help me

Hi i have a question with your application can you down- or upload more files at the same time? Because i'm having problems with my ftp application.
Here is the link with my problem maybe you can help me. I will be very pleased when you can help me.
http://forum.java.sun.com/thread.jspa?threadID=5162042&tstart=0
Thx
Satanduvel

Similar Messages

  • How do you create a jar file with txt and classes?

    Hey, I'm trying to create code to create a jar file with a text file, but I can't figure out how to add the text file. Here is what I have so far:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
            }It creates the .jar file with the correct manifest but I can't get it to write the test.txt or anything else into the jar file.
    -Gandolf
    Edited by: GanMatt on Jun 18, 2009 8:18 AM
    Edited by: GanMatt on Jun 18, 2009 8:19 AM

    Alright, my question has changed. Here's the code:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.write("Hi".getBytes());
                out.flush();
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,ex.toString(),"BUG!",JOptionPane.INFORMATION_MESSAGE);
            }It creates the jar file with the txt file inside it, but I can't write "Hi" inside of the text file. Any ideas?
    -Gandolf

  • How to run jar file with classpath?

    Hi, all,
    I have some package in my project, with which I have a java help jar file as classpath, when I run my project, I need the jh.jar file in directory /jar/jh.jar.
    Now, I bundled all my class packages into a jar file, my.jar, together with the /jar directory. When i run my jar file with command:
    java -jar my.jar
    It tells me couldn't find javahelp class.
    What shall I do? How can I create my jar file with the jh.jar?
    Thanks in advance.

    Thanks, hjembaek,
    But it doesn't work for me. I am running in windows, it still generate the error:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/help/HelpSet
    at own.gui.OwnMenuToolBar.getOwnHelpBroker(OwnMenuToolBar.java:560)
    at own.gui.OwnMenuToolBar.addHelpMenu(OwnMenuToolBar.java:327)
    at own.gui.OwnMenuToolBar.getOwnMenuBar(OwnMenuToolBar.java:188)
    at own.gui.OWNDPTool.initGui(OWNDPTool.java:55)
    at own.gui.OWNDPTool.<init>(OWNDPTool.java:39)
    at own.gui.OWNDPTool.main(OWNDPTool.java:100)
    Here is my command to generate the jar file:
    jar cfm Own.jar temp.txt help own log others
    temp.txt is the file including the main class and class path information
    I have help folder, log folder and own package, others is directory that has the jar file(others/jh.jar)

  • Exporting a jar file with its libraries

    Hi there,
    I have problem while exporting jar files with Eclipse.My program uses db2driver libraries and i want to make stay these library files while exporting the main program but there is no choice to make it like that. And when i execute my program jar file it throws a class not found exception for db2drivers ...
    How can i pack the jar files with my program jar?
    Thanks for help.

    Hi Peter,
    I made the changes but still got the problem...
    here is my .classpath file:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry exported="true" kind="lib" path="db2jcc_license_cu.jar"/>
    <classpathentry exported="true" kind="lib" path="db2jcc.jar"/>
    <classpathentry kind="output" path="bin"/>
    </classpath>
    when i execute my jar file it throws a ClassNotFoundExeption for DB2Drivers which are in db2jcc.jar ...(my startng class is at src package)
    Thanks..

  • How can I get a single jar file with NetBeans?

    How can I get a single jar file with NetBeans?
    When I create the project I get these files:
    dist/lib/libreria1.jar
    dist/lib/libreria2.jar
    dist/software.jar
    The libraries that have been imported to create the project are in separate folders:
    libreria1/libreria1.jar
    libreria2/libreria2.jar
    libreria1, libreria2, dist folders are all located inside the project folder.
    I added the following code to the build.xml:
    <target name="-post-jar">
    <jar jarfile="dist/software.jar">
    <zipfileset src="${dist.jar}" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria1.jar" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria2.jar" excludes="META-INF/*" />
    <manifest>
    <attribute name="Main-Class" value="pacco.classeprincipale"/>
    </manifest>
    </jar>
    </target>
    Of course there is also the project folder:
    src/pacco/classeprincipale.form
    src/pacco/classeprincipale.java
    Can you tell me what is wrong? The error message I get is as follows:
    C:...\build.xml:75: Problem creating jar: archive is not a ZIP archive BUILD FAILED (total time: 2 seconds)

    This is not a NetBeans forum, it is a JDeveloper forum. You might want to try http://forums.netbeans.org/. I also saw your other question - try looking in the New to Java forum: New To Java

  • How to run jar files with arguments?

    Hi everybody,
    Is it possible to run a jar file with arguments passed to its MAIN class?
    If yes can you help me on how to do it?
    Thanx

    I am in complete agreement with FahleE. I'll refine it a bit.
    On my machine (running RedHatLinux8.0) you can run the demos like this.
    1. open a console window
    2. go to the directory where the demo you wish to run, say, demo.jar, is located
    for instance for the SwingSet2-demo
    cd /usr/lib/java/demo/jfc/SwingSet2
    3. run the jar file
    java -jar demo.jar
    In order to run it windows style, ie, launching by double clicking, save these lines in a file called
    LaunchJar.sh
    cd /usr/lib/java/demo/jfc/SwingSet2
    java -jar demo.jar
    where demo.jar is the jar file you want to run.
    Right click on the LaunchJar.sh and go to the 'Properties' tab. Check the 'Execute' permissions for Owner/groups/others. You can also do the same thing by chmod command.
    Now double-click on the LaunchJar.sh file: your application should be launched.
    Palash.
    Please Note: It is important to set the path variable to your JAVA_HOME directory....
    Otherwise, instead of
    java -jar demo.jar, you will need to use the full path to your JAVA_HOME/bin directory like:
    JAVA_HOME/bin /java -jar demo.jar.
    Where JAVA_HOME is the directory where you have installed java. Typically it is usr/java or usr/local/java

  • How do I merge multiple Excel files with more than one tab in each file using PowerQuery?

    Hello
    I have 12 Excel (.xlsx) files and each file has three identically named and ordered tabs in them. 
    I know how to merge multiple Excel files in a folder using M (those guides are all over the web) but how do I merge multiple Excel files with multiple (yet identically named and ordered) tabs? Surely it is possible? I just don't know how to do it in M.
    Cheers
    James

    What Laurence says is correct, and probably the best thing to do when the sheets have differing structures. Here is an alternate approach that works well when the sheets all have the same structure.
    When you first open the Excel file from Power Query, you can see its structure in the navigator at the right-hand-side of the screen. If you select the root (which is the filename itself) and click Edit, you'll see all the tabs in the sheet as a single table.
    You can now do filtering based on the Name, Item and Kind values. When you've reduced the set of things down to the sheets you want, select the Data column and say "Remove Other Columns". If the sheets don't have any header rows, you can just click the expand
    icon in the header and you'll be done.
    Otherwise, if the sheets have headers or if some other kind of sheet-level transformation is required against each sheet before doing a merge, you'll have to write some M code manually. In the following example, each sheet has a header row consisting of
    two columns: Foo and Bar. So the only step I need to perform before merging is to promote the first row into a header. This is done via the Table.TransformColumns operation.
    let
        Source = Excel.Workbook(File.Contents("C:\Users\CurtH\Desktop\Test1.xlsx")),
        RemovedOtherColumns = Table.SelectColumns(Source,{"Data"}),
        PromotedHeaders = Table.TransformColumns(RemovedOtherColumns,{{"Data", each Table.PromoteHeaders(_)}}),
        ExpandData = Table.ExpandTableColumn(PromotedHeaders, "Data", {"Foo", "Bar"}, {"Data.Foo", "Data.Bar"})
    in
        ExpandData

  • ServiceBus java callout - how to pack the JAR file with libraries?

    Hello
    I want to use a Java Callout from a Service Bus flow.
    What is the correct way to pack the JAR file with its nessecary libraries?
    I tried different methods to pack my JAR, but yet, as though the Java runs perfectly from the Workshop (Eclipse) , when I am trying to use the exported Jar on the ServiceBus flow, it fails with an ClassNotFoundException.
    I would really appreciate your advice here.
    Thanks
    Koby

    Well.. Looking inside my exported JAR file, I got all of the files there inside, including the jar file containing the library.
    What I'm trying to do is run a simple java program that connect through SSH and therefore use an SSH library.
    On the workshop I got it as an imported library JAR. And it works perfectly there.
    Any idea?
    Here's the complete error I get:
    <BEA-382515> <Callout to java method "public static java.lang.String sshpackage.SshProg.remoteScriptInvoke(java.lang.String,java.lang.String,java.lang.String,java.lang.String)" resulted in exception: null
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:158)
    Truncated. see log file for complete stacktrace
    java.lang.NoClassDefFoundError: ch/ethz/ssh2/Connection
    at sshpackage.SshProg.remoteScriptInvoke(SshProg.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: ch.ethz.ssh2.Connection
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at com.bea.wli.sb.resources.archive.HookedJarClassLoader.loadClass(HookedJarClassLoader.java:251)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    Truncated. see log file for complete stacktrace
    Edited by: kobyssh on 04:12 01/02/2010

  • How can i run a jar file as EXE on mouse click..

    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*

    amrit_j2ee wrote:
    *{color:#0000ff}how can i run a jar file as EXE on mouse click..is it possible in any way?????????{color}*Do you mean converting it from a jar file to an EXE file or do you mean that you would like to run the application by just double clicking it?
    If it's the latter then you need to make the jar file including a manifest.
    The manifest can be just a txt file with its content to be something like this:
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.7.1
    Created-By: Somebody
    Main-Class: NameOfTheMainClass
    Class-Path:
    X-COMMENT: Main-Class will be added automatically by buildTo make the jar file including the manifest, use something like this in your command prompt (of course you must have compiled your java file(s) first):
    jar cfm test.jar MANIFEST.txt NameOfTheMainClass.classAfter that you'd be able to run your application just by double clicking it.
    If you're a NetBeans user, you can build your standalone application by right-clicking your project and then going to properties => run => and choosing a Main class. After that right click on that project and "Clean and Build", locate the jar file in the "dist" folder and double click it =]
    Hope it helps,
    LD

  • How to handle errors in a file at sender side?

    Hi
    I have done a file to proxy scenario.
    I know how to handle errors on proxy.
    But on sender side when picking the file if one the record have worng fomat its throwing mapping error and its not processing any record..
    I wanted to process the records which have right format and data and  all remaining recrods which have wromg format should be send back to the sender as file.
    How to do this.
    How to handle error in sender file.
    Regards
    Sowmya

    Hello Sowmya,
    In your scenario Three ways you can validate the data.
    1) Before the data reaches into SAP system ie in XI system during Mapping or before mapping i,e in Adapter Module in the Sender side
    2) this option, is in the receiver applications side. ie. Validations will be taken care in the SAP system i.e in ABAP server proxy code.
    3)Through BPM, If Mapping Exception Occures then through exception Branch you can send bad formate file to sender again.
    Generally, it is prefer to more business critical validations in the Application System ie Receiver Application System (ABAP Server Proxy)
    In this, you can have more flexibility of the validations as you are validating some of the SAP payroll informations as Personal ID etc.
    Based on the complexity and flexibility of the requirement, you can either do this in the XI (if XI, ie Sender Adapter Module or Mapping) or in the ABAP proxy
    Thanks'
    Sunil Singh

  • How can I create a jar file that will run automatically on double click

    all the jars I created run only from the command-line.
    how can I make it run by double-click on it?

    First you will need to associate .jar files with the javaw.exe program in order to just be able to double click on the jar and run it from within a windows explorer application. Next you will need to set the main class attribute of the manifest file. My understanding is that the value of this attribute is used by the launcher to know which class to load. In other words, which is your main application class. To specify this attribute open your manifest file in a text editor. You will find this file located within the jar at META-INF/MANIFEST.MF. Then, add the line,
    "Main-Class:<relative path to the main class>" However, remember not to add the .class extension to the end of the class name.
    In Windows 2000 you can associate jar files with javaw by finding a jar file in Windows Explorer and right clicking it. This will give you a context menu which should have an Open With... option (if you are not using Windows 2000 and don't see the 'open with' menu item, try holding down the shift button while right click on the file). Select the Open With... option, then, when the dialog appears highlight javaw and select the "Always use this program to open these files" checkbox. When you hit the OK button you should have all your jar files associated with the javaw process.
    Once you've done this, you should be able to double click on your jar file and run your application.
    Regards,
    Daniel Walsh

  • Applet : How to use Images in Jar file

    I want to put all images into a jar file to improve speed of loading.
    But how to invoke images from Jar file?
    Thanks.

    @Op. It's very important for a developer to know how to find information, and that skill usually comes with experience. Google is one of the best ways to find information and solutions to the most common problems.
    Kaj

  • How to call function in jar file?

    First, I can't write english well.(I'm korean.. ) sorry about that.
    I have known function in jar file.
    but I don't know how to call function in jar file.
    how can I this work?
    My project and another project are respectively developing D-project with me and other man.
    so i need it. or I can't do this work.
    I will paste other's source code in my source code.
    and then recomplie , build it.. but it is not my wish!
    thanks for reading my sentence.

    If you have a jar file with a class that you wish to use, then you must add the jar file to your class path ($CLASSPATH on unix, linux, etc. and %CLASSPATH% on Windows).
    Then you can use the class normally, just as you would if it were not in the jar.
    If you meant something else, you'll need to explain what you meant.

  • How to add the mail.jar file to my CLASSPATH ?

    Hi;
    I wish to Instal JavaMail 1.2
    To use the JavaMail 1.2 API, i unbundle the javamail-1_3_1-upd.zip file.....and now, i would like to add the mail.jar file to your CLASSPATH.
    My question is: how do you do this ?
    - ok i did that for CATALINA_HOME & JAVA_HOME but how to add the mail.jar file to my CLASSPATH ??
    1000 thanks.

    I think you're looking for "developer support", not packaged application support. different server, different batch of groups. . .
    Since I have very little contact with devopers, I don't truly know.

  • How to generate a second csv file with different report columns selected?

    Hi. Everybody:
    How to generate a second csv file with different report columns selected?
    The first csv file is easy (report attributes -> report export -> enable CSV output Yes). However, our users demand 2 csv files with different report columns selected to meet their different needs.
    (The users don't want to have one csv file with all report columns included. They just want to get whatever they need directly, no extra columns)
    Thank you for any help!
    MZ

    Hello,
    I'm doing it usually. Typically example would be in the report only the column "FIRST_NAME" and "LAST_NAME" displayed whereas
    in the csv exported with the UTL_FILE the complete address (street, housenumber, additions, zip, town, state ... ) is written, these things are needed e.g. the form letters.
    You do not need another page, just an additional button named e.g. "export_to_csv" on your report page.
    The csv export itself is handled from a plsql procedure "stored procedure" ( I like to have business logic outside of apex) which is invoked by pressing the button "export_to_csv". Of course the stored procedure can handle also parameters
    An example code would be something like
    PROCEDURE srn_brief_mitglieder (
         p_start_mg_nr IN NUMBER,
         p_ende_mg_nr IN NUMBER
    AS
    export_file          UTL_FILE.FILE_TYPE;
    l_line               VARCHAR2(20000);
    l_lfd               NUMBER;
    l_dateiname          VARCHAR2(100);
    l_datum               VARCHAR2(20);
    l_hilfe               VARCHAR2(20);
    CURSOR c1 IS
    SELECT
    MG_NR
    ,TO_CHAR(MG_BEITRITT,'dd.mm.yyyy') AS MG_BEITRITT ,TO_CHAR(MG_AUFNAHME,'dd.mm.yyyy') AS MG_AUFNAHME
    ,MG_ANREDE ,MG_TITEL ,MG_NACHNAME ,MG_VORNAME
    ,MG_STRASSE ,MG_HNR ,MG_ZUSATZ ,MG_PLZ ,MG_ORT
    FROM MITGLIEDER
    WHERE MG_NR >= p_start_mg_nr
    AND MG_NR <= p_ende_mg_nr
    --WHERE ROWNUM < 10
    ORDER BY MG_NR;
    BEGIN
    SELECT TO_CHAR(SYSDATE, 'yyyy_mm_dd' ) INTO l_datum FROM DUAL;
    SELECT TO_CHAR(SYSDATE, 'hh24miss' ) INTO l_hilfe FROM DUAL;
    l_datum := l_datum||'_'||l_hilfe;
    --DBMS_OUTPUT.PUT_LINE ( l_datum);
    l_dateiname := 'SRNBRIEF_MITGLIEDER_'||l_datum||'.CSV';
    --DBMS_OUTPUT.PUT_LINE ( l_dateiname);
    export_file := UTL_FILE.FOPEN('EXPORTDIR', l_dateiname, 'W');
    l_line := '';
    --HEADER
    l_line := '"NR"|"BEITRITT"|"AUFNAHME"|"ANREDE"|"TITEL"|"NACHNAME"|"VORNAME"';
    l_line := l_line||'|"STRASSE"|"HNR"|"ZUSATZ"|"PLZ"|"ORT"';
         UTL_FILE.PUT_LINE(export_file, l_line);
    FOR rec IN c1
    LOOP
         l_line :=  '"'||rec.MG_NR||'"';     
         l_line := l_line||'|"'||rec.MG_BEITRITT||'"|"' ||rec.MG_AUFNAHME||'"';
         l_line := l_line||'|"'||rec.MG_ANREDE||'"|"'||rec.MG_TITEL||'"|"'||rec.MG_NACHNAME||'"|"'||rec.MG_VORNAME||'"';     
         l_line := l_line||'|"'||rec.MG_STRASSE||'"|"'||rec.MG_HNR||'"|"'||rec.MG_ZUSATZ||'"|"'||rec.MG_PLZ||'"|"'||rec.MG_ORT||'"';          
    --     DBMS_OUTPUT.PUT_LINE (l_line);
    -- in datei schreiben
         UTL_FILE.PUT_LINE(export_file, l_line);
    END LOOP;
    UTL_FILE.FCLOSE(export_file);
    END srn_brief_mitglieder;Edited by: wucis on Nov 6, 2011 9:09 AM

Maybe you are looking for