Jar file is empty

Hi,
I am trying to package a small application into a jar file, but besides the manifest, the jar comes out empty.
My directory structure is a s follows
/mydir/src/ [java files and manifest.txt]
/mydir/bin/[compiled java classes in packages]
I run the following command from /mydir/src/: jar cmf manifest.txt ../bin/MyJar.jar ../bin
I understood that the last argument - ../bin should tell the utility to include all the contents of the bin directory - where my class files are. But they are not in the jar.

alexxzius wrote:
jarring might not work on some computers (it doesnt on my XP). What you do is create a zip file, add all the files/folders with a META-INF folder with a MANIFEST.MF file in it and then rename it with a .jar extension.Well, IMHO what you do is fix your configuration so you can use the jar command. But to each his own.

Similar Messages

  • How to add empty folder in a jar file ?

    Well
    I know how to add files in a jar file but I cannot add empty folder.
    I would like to do this so that when I get back the jar file I can have all the structure of the save main folder.
    I also test that it is possible to do that on line with the "jar" command.
    Does any of you know how to do this programacticaly ?
    Thanks in advance

         JarOutputStream jos = // ...
         jos.putNextEntry(new JarEntry("directory/"));
         jos.closeEntry();
         jos.finish();
         jos.close();on the command line:
    jar -tf <your_jar_file.jar>

  • Application working under NetBeans but not as a *.jar file

    Hello,
    recently I found a little problem. I wrote application that shows all available ports in my computer. When I am running this applications under NetBeans it works with no problem - finds all available ports. Then I am building it to the *.jar file. Application is working with no problem but command:
    Enumeration PortIds = CommPortIdentifier.getPortIdentifiers();
    is not returning any identifiers - PortIds is empty.
    Anyone knows a solution for this type of problems? Thanks

    Hi Venkatesh,
    Few questions.
    1. What is your JDeveloper version? (Always better to post your JDev version along with the question, which would help us to help you better).
    2. Did you try adding webserviceclient.jar to the classpath? (Search in your JDev installation directory for the location of this jar file).
    -Arun

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      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)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

  • Using a JAR file as a project file

    My application allows the user to create projects. Previously, a project file was simply an XML file. Now, a project file needs to also contain many images.
    I thought it would be a good idea to simply use a JAR file as my project file.
    Since I've really never really worked with JAR files and the java.util.Jar package directly, I have a few questions.
    1) Would it be better just to simply store the images as binary in the XML file? I just spent a good amount of time making the XML file very readable so I thought it would be better to keep the images separate while still having a single "project" file.
    2) Is there anything inherently wrong with the way I'm working with the JAR file in the code below?
    Simple XML file:
    <?xml version="1.0" encoding="utf-8"?>
    <!DOCTYPE project [
      <!ELEMENT project (img+)>
      <!ELEMENT img EMPTY>
      <!ATTLIST img src CDATA #REQUIRED>
    ]>
    <project>
         <img src="blah.jpg"/>
    </project>
    import java.io.*;
    import java.util.jar.JarFile;
    import javax.xml.parsers.*;
    import org.xml.sax.*;
    import org.xml.sax.helpers.DefaultHandler;
    public class LoaderTest {
        private String imageName;
        public LoaderTest() {
            InputStream i = null;
            JarFile jf = null;
            try {
                jf = new JarFile("project.jar");
                i = jf.getInputStream(jf.getJarEntry("project.xml"));
                // Here's my simple XML parser to load the project and images
                SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
                parser.parse(new InputSource(i), new DefaultHandler() {
                    @Override
                    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
                        // Right now we only care about images
                        if (qName.equalsIgnoreCase("img")) {
                            imageName = attributes.getValue("src");
                // Load the image from the inputstream
                java.awt.image.BufferedImage img = javax.imageio.ImageIO.read(jf.getInputStream(jf.getJarEntry(imageName)));
                // Display the image in a JFrame
                javax.swing.JFrame f = new javax.swing.JFrame();
                f.setLayout(new java.awt.BorderLayout());
                f.setSize(800, 600);
                f.getContentPane().add(new javax.swing.JLabel(new javax.swing.ImageIcon(img)), java.awt.BorderLayout.CENTER);
                f.setDefaultCloseOperation(javax.swing.JFrame.EXIT_ON_CLOSE);
                f.setVisible(true);
            } catch (ParserConfigurationException ex) {
                ex.printStackTrace();
            } catch (SAXException ex) {
                ex.printStackTrace();
            } catch (IOException ex) {
                ex.printStackTrace();
            } finally {
                // Do our best to close the input streams
                if (i != null) {
                    try {
                        i.close();
                    } catch (IOException ex) {}
                if (jf != null) {
                    try {
                        jf.close();
                    } catch (IOException ex) {}
        public static void main(String[] args) {
            new LoaderTest();
    }Thank you!

    1) I also think it's much better to keep your images separate from your XML, this prevents a lot of in case you just want to read XML data
    2) What's exactly going wrong here? For the project.xml, make sure it's not inside a directory within the JAR file, or else the variable i will be null. Otherwise it looks fine..

  • Adding JAR file to project

    Hi All
    How can i add jar to my project environment.
    Actually what i did was.
    Created one folder called "JavaWork" like d:\JavaWork
    and put the jar file into this folder and wrote a test class which is importing some classes from the jar file.
    how to use jar ? Please someone help me.
    Thanks in advance
    Shan

    `man jar`
    jar(1) jar(1)
    NAME
    jar - Java archive tool
    SYNOPSIS
    jar [ -C ] [ c ] [ f ] [ i ] [ M ] [ m ] [ O ] [ t ] [ u ]
    [ v ]
    [ x file ] [ manifest-file ] destination input-file
    [ input-files ]
    DESCRIPTION
    The jar tool is a Java application that combines multiple
    files into a single JAR archive file. It is also a gen-
    eral-purpose archiving and compression tool, based on ZIP
    and the ZLIB compression format. However, jar was
    designed mainly to facilitate the packaging of Java
    applets or applications into a single archive. When the
    components of an applet or application (.class files,
    images and sounds) are combined into a single archive,
    they can be downloaded by a Java agent (like a browser) in
    a single HTTP transaction, rather than require a new con-
    nection for each piece. This dramatically improves down-
    load time. The jar tool also compresses files, which fur-
    ther improves download time. In addition, it allows indi-
    vidual entries in a file to be signed by the applet author
    so that their origins can be authenticated. The syntax
    for the jar tool is almost identical to the syntax for the
    tar(1) command. A jar archive can be used as a class path
    entry, whether or not it is compressed.
    The three types of input files for the jar tool are:
    o Manifest file (optional)
    o Destination jar file
    o Files to be archived
    Typical usage is:
    example% jar cf myjarfile *.class
    In this example, all the class files in the current direc-
    tory are placed in the file named myjarfile. A manifest
    file is automatically generated by the jar tool and is
    always the first entry in the jar file. By default, it is
    named META-INF/MANIFEST.MF. The manifest file is the
    place where any meta-information about the archive is
    stored. Refer to the Manifest Format in the SEE ALSO sec-
    tion for details about how meta-information is stored in
    the manifest file.
    To use a pre-existing manifest file to create a new jar
    archive, specify the old manifest file with the m option:
    example% jar cmf myManifestFile myJarFile *.class
    When you specify cfm instead of cmf (that is, you invert
    the order of the m and f options), you need to specify the
    name of the jar archive first, followed by the name of the
    manifest file:
    example% jar cfm myJarFile myManifestFile *.class
    The manifest uses RFC822 ASCII format, so it is easy to
    view and process manifest-file contents.
    OPTIONS
    The following options are supported:
    -C Changes directories during execution of the jar com-
    mand. For example:
    example% jar uf foo.jar -C classes *
    c Creates a new or empty archive on the standard out-
    put.
    f The second argument specifies a jar file to process.
    In the case of creation, this refers to the name of
    the jar file to be created (instead of on stdout).
    For table or xtract, the second argument identifies
    the jar file to be listed or extracted.
    i Generates index information for the specified jar
    file and its dependent jar files. For example,
    example% jar i foo.jar
    would generate an INDEX.LIST file in foo.jar which con-
    tains location information for each package in foo.jar and
    all the jar files specified in foo.jar's Class-Path
    attribute.
    M Does not create a manifest file for the entries.
    m Includes manifest information from specified pre-
    existing manifest file. Example use:
    example% jar cmf myManifestFile myJarFile *.class
    You can add special-purpose name-value attribute
    headers to the manifest file that are not contained
    in the default manifest. Examples of such headers
    are those for vendor information, version informa-
    tion, package sealing, and headers to make JAR-bun-
    dled applications executable. See the JAR Files
    trail in the Java Tutorial and the JRE Notes for
    Developers web page for examples of using the m
    option.
    O Stores only, without using ZIP compression.
    t Lists the table of contents from standard output.
    u Updates an existing JAR file by adding files or
    changing the manifest. For example:
    example% jar uf foo.jar foo.class
    adds the file foo.class to the existing JAR file
    foo.jar, and
    example% jar umf foo.jar
    updates foo.jar's manifest with the information in
    manifest.
    v Generates verbose output on stderr.
    x file
    Extracts all files, or just the named files, from
    standard input. If file is omitted, then all files
    are extracted; otherwise, only the specified file or
    files are extracted.
    If any of the files is a directory, then that direc-
    tory is processed recursively.
    EXAMPLES
    To add all of the files in a particular directory to an
    archive:
    example% ls
    0.au 3.au 6.au 9.au at_work.gif
    1.au 4.au 7.au Animator.class monkey.jpg
    e.au 5.au 8.au Wave.class spacemusic.au
    example% jar cvf bundle.jar *
    adding: 0.au
    adding: 1.au
    adding: 2.au
    adding: 3.au
    adding: 4.au
    adding: 5.au
    adding: 6.au
    adding: 7.au
    adding: 8.au
    adding: 9.au
    adding: Animator.class
    adding: Wave.class
    adding: at_work.gif
    adding: monkey.jpg
    adding: spacemusic.au
    example%
    If you already have subdirectories for images, audio
    files, and classes that already exist in an HTML direc-
    tory, use jar to archive each directory to a single jar
    file:
    example% ls
    audio classes images
    example% jar cvf bundle.jar audio classes images
    adding: audio/1.au
    adding: audio/2.au
    adding: audio/3.au
    adding: audio/spacemusic.au
    adding: classes/Animator.class
    adding: classes/Wave.class
    adding: images/monkey.jpg
    adding: images/at_work.gif
    example% ls -l
    total 142
    drwxr-xr-x 2 brown green 512 Aug 1 22:33 audio
    -rw-r--r-- 1 brown green 68677 Aug 1 22:36 bundle.jar
    drwxr-xr-x 2 brown green 512 Aug 1 22:26 classes
    drwxr-xr-x 2 brown green 512 Aug 1 22:25 images
    example%
    To see the entry names in the jar file using the jar tool
    and the t option:
    example% ls
    audio bundle.jar classes images
    example% jar tf bundle.jar
    META-INF/MANIFEST.MF
    audio/1.au
    audio/2.au
    audio/3.au
    audio/spacemusic.au
    classes/Animator.class
    classes/Wave.class
    images/monkey.jpg
    images/at_work.gif
    example%
    To display more information about the files in the
    archive, such as their size and last modified date, use
    the v option:
    example% jar tvf bundle.jar
    145 Thu Aug 01 22:27:00 PDT 1996 META-INF/MANIFEST.MF
    946 Thu Aug 01 22:24:22 PDT 1996 audio/1.au
    1039 Thu Aug 01 22:24:22 PDT 1996 audio/2.au
    993 Thu Aug 01 22:24:22 PDT 1996 audio/3.au
    48072 Thu Aug 01 22:24:23 PDT 1996 audio/spacemusic.au
    16711 Thu Aug 01 22:25:50 PDT 1996 classes/Animator.class
    3368 Thu Aug 01 22:26:02 PDT 1996 classes/Wave.class
    12809 Thu Aug 01 22:24:48 PDT 1996 images/monkey.jpg
    527 Thu Aug 01 22:25:20 PDT 1996 images/at_work.gif
    example%
    If you bundled a stock trade application (applet) into the
    following jar files,
    main.jar buy.jar sell.jar other.jar
    and you specified the Class-Path attribute in main.jar's
    manifest as
    Class-Path: buy.jar sell.jar other.jar
    then you can use the i option to speed up your applica-
    tion's class loading time:
    example$ jar i main.jar
    An INDEX.LIST file is inserted in the META-INF directory
    which will enable the application class loader to download
    the right jar files when it is searching for classes or
    resources.
    SEE ALSO
    keytool(1)
    JAR Files @
    http://java.sun.com/docs/books/tutorial/jar/
    JRE Notes @
    http://java.sun.com/j2se/1.3/runtime.html#exam-
    ple
    JAR Guide @
    http://java.sun.com/j2se/1.3/docs/guide/jar/index.html
    For information on related topics, use the search link @
    http://java.sun.com/
    13 June 2000 jar(1)

  • Import JAR files (integrating JasperReports)

    Dear all,
    I'm using JDeveloper 11.1.1.3.0 on Windows 7 32bit.
    I search this forum and I google a lot, but I couldn't find any workable solution.
    I downloaded the newest version of JasperReport and iReport from the official website. I've done some tutorials from this site and everything seems to work fine.
    Now I want to integrate JDev with JasperReports. I create new Fusion Web Application ADF, I get the properties of Model project, Libraries and Classpath tab, add Library and click New... I set the Library name as JasperReports, location as Project, check Deploy ad Default. I add to Class path every JAR files in E:\JasperReports\jasperreports-3.7.6\lib and to Source path the whole directory E:\JasperReports\jasperreports-3.7.6\src. I get sure that the Export is checked and I save all the changes.
    I create a new Java Class JasperTest and I use this sample code:
    import net.sf.jasperreports.engine.*;
    import net.sf.jasperreports.engine.export.*;
    import java.util.*;
    public class JasperTest {
        public static void main(String[] args) {
            String fileName = "test.jasper";
            String outFileName = "test.pdf";
            HashMap hm = new HashMap();
            try {
                // Fill the report using an empty data source
                JasperPrint print = JasperFillManager.fillReport(fileName, hm, new JREmptyDataSource());
                // Create a PDF exporter
                JRExporter exporter = new JRPdfExporter();
                // Configure the exporter (set output file name and print object)
                exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, outFileName);
                exporter.setParameter(JRExporterParameter.JASPER_PRINT, print);
                // Export the PDF file
                exporter.exportReport();
            } catch (JRException e) {
                e.printStackTrace();
                System.exit(1);
            } catch (Exception e) {
                e.printStackTrace();
                System.exit(1);
    }I cant compile this, it gives me Error(1,1): package net.sf.jasperreports.engine does not exist etc..
    I cant import any class from JasperReports. Did I something wrong with importing the JAR files to my project ? Maybe I should set some system environment variable ? What else I can do ?
    Any help will be appraciated.
    Regards,
    Wojtek.

    Hi,
    I am also facing the same problem, I have few Jasper Reports which are closely integrated with my APEX applications, but for this i am using another application ( Jasper reports) which deployed in tomcat. This application hardly have 20 lines of java code, so i thought of embedding same in PL/SQL itself, But i am facing problem while importing JAR files i.e.
    1. Where to put these JAR files so that i can import them in my PL/SQL.
    2. I also tried using JAVALOAD function, but that also not worked for me.
    Please give me some solution how to go about it??

  • XML Sax Exception with 9.2.0.5 express*.jar files for Olap API

    I was using the olap_api_92.jar that
    came with jdeveloper for the olap api and having a coding problem.. In trying to see
    if I could resolve the previous problem, I set my classpath to use the jar files provided with the 9.2.0.5
    install for AiX.. all beginning with express*.jar
    I now get an XML parsing error that I can't fix..
    which jar is good, the olap_api_92.jar seems to work..
    Help!
    thanks,
    Lisa Cox
    OCLC Inc.
    java.lang.RuntimeException: org.xml.sax.SAXParseException: <Line 179, Column 18>: XML-0124: (Fatal Error) An attribute cannot appear more than once in the same start tag.
    at oracle.olapi.metadata.MetadataFetcher.processXML(MetadataFetcher.java:237)
    at oracle.olapi.metadata.MetadataFetcher.fetchBaseMetadataObjects(MetadataFetcher.java:180)
    at oracle.olapi.metadata.BaseMetadataProvider.fetchMetadataObject(BaseMetadataProvider.java:150)
    at oracle.olapi.metadata.BaseMetadataProvider.fetchMetadataObject(BaseMetadataProvider.java:107)
    at oracle.olapi.metadata.mdm.MdmMetadataProvider.getMetadataObject(MdmMetadataProvider.java:147)
    at oracle.olapi.metadata.mdm.MdmMetadataProvider.getRootSchema(MdmMetadataProvider.java:174)
    at oracle.express.mdm.MdmMetadataProvider.getRootSchema(MdmMetadataProvider.java:144)
    at org.oclc.xwc.olap.OlapClient.main(OlapClient.java:494)

    The OLAP component versions are empty.
    <Check key="OLAP Catalog version" value=""/>
    <Check key="OLAP AW Engine version" value=""/>
    <Check key="OLAP API Server version" value=""/>
    Please doublecheck that the catpatch.sql script ran without any errors.
    Aneel Shenker
    Senior Product Manager
    Oracle Corp.

  • Java Access Helper Jar file problem

    I just downloaded Java Access Helper zip file, and unzipped, and run the following command in UNIX
    % java -jar jaccesshelper.jar -install
    I get the following error message, and the installation stopped.
    Exception in thread "main" java.lang.NumberFormatException: Empty version string
    at java.lang.Package.isCompatibleWith(Package.java:206)
    at jaccesshelper.main.JAccessHelperApp.checkJavaVersion(JAccessHelperApp.java:1156)
    at jaccesshelper.main.JAccessHelperApp.instanceMain(JAccessHelperApp.java:159)
    at JAccessHelper.main(JAccessHelper.java:39)
    If I try to run the jar file, I get the same error message.
    Does anyone know how I can fix this?
    Thanks

    Cross-posted, to waste yours and my time...
    http://forum.java.sun.com/thread.jsp?thread=552805&forum=54&message=2704318

  • How to include images/icons for a jar file

    Hi,
    I need to create a jar file which will contain my application. My source code (.java) files are in "app" folder. I compiled that using javac -d . *.java and one package("appl") was created. I have all icons and images related to my application are in the folder named "icons" in the directory where source files are located i.e; app folder - "app/icons". I am accessing the images in the icons directory as "icons/book.gif".
    I created a jar file from source file directory with the option
    jar cvf app.jar app
    and i added this jar file to my classpath also.
    I have created a batch file to execute this application and set that batch file to "path" environment variable.
    It is running from any directory but no icons are appearing in that application if i try to run the application out side the "app" folder.
    Can any body give suggessions to solve this problem?

    Thanks for the added info, now let's get started.
    To use files in jars, you need to refer to them via a URL, so you'll need to modify your code a little bit first.
    URL imgURL = ClassLoader.getSystemResource("icons/BOOK.gif");
    setIconImage(Toolkit.getDefaultToolkit().getImage(imgURL));Next, you'll need a manifest. Using any text editor such as notepad, create a file called manifest.txt and put two lines in it. The first line will specify the class (w/o .class on the end) that contains your public static void main method, the second line is just an empty line (just press return).
    Main-Class: main
    (a blank line)
    Save this file with your class files (e.g. in Exam folder).
    Next build your jar. We want the jar to contain the package folder and your icon folder as well. So use this:
    jar cmf Exam/manifest.txt myJar.jar Exam/*.class icons
    And you should now have an executable jar. You can run it from dos with:
    java -jar myJar.jar
    or you can double-click it from windows.
    -Ron

  • How to Remove Jar File name from the screen of nokia 40 series

    hi
    i have the problem with running midlet.
    the jar file jame is always visible on the screen, how to remove that ?

    >
    Prasanna Kumar wrote:
    > Hi ALL
    >
    > I am using  file adapter and I what to create file name dynamically by acesssing PO number and time stamp from the payload using variable substution.
    > But the problem is I am getting ":" in time stamp field value and it is not acceptable for file name .
    > So could you please tell me a way that I can remove this ":" from that particular field value and create the file name dynamically.
    >
    > Note 1)Add Time stamp option will not help me as we require a time stamp of particular zone.
    > 2) Dynamic Configuration code is also not use full as I am using 1:n file creation
    does the time stamp with the ":" a part of your output file?
    else use a replaceAll function in your mapping and replace the : with empty string then use the value in the variable substitution
    Another option is use the normal BPM for 1: N message flow. The use a simple java mapping that will introduce a dynamic configuration and you can create the file name as you want. the java mapping will be used in the flow of messages from BPM to target system.
    ref: /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

  • Error in creating JAR file

    I have created an application and I have used JCreator to compile and run it.
    My next step is that I want to make my application as executable jar
    I did the following:
    1- I made a package name called transpackage and I have include it in each file
    2- I have executed the command : jar cfm MyJar.jar Manifest.txt transpackage/*.class
    3- Manifest.txt file contains the following line :
    Main-Class: transpackage.JavaTrans and an empty line after it.
    4- If I executed the follwing line to run the jar file:
    java -jar MyJar.jar
    I got the follwing error:
    Exception in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTran
    s com/sun/jdi/connect
    Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans com.sun.jdi.
    connect
    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)
    Please advise what the problem here is. I couldn't figure it out. Thanks for help

    Here is a copy of my command line:
    C:\Documents and Settings\isz\Desktop\JavaTrans>jar cvfm MyJar.jar manifest.mft transpackage\*.classadded manifest
    adding: transpackage/EventThread$ThreadTrace.class(in = 5566) (out= 2396)(deflat
    ed 56%)
    adding: transpackage/EventThread.class(in = 9867) (out= 4114)(deflated 58%)
    adding: transpackage/Info.class(in = 1036) (out= 484)(deflated 53%)
    adding: transpackage/JavaTrans$1.class(in = 2531) (out= 1304)(deflated 48%)
    adding: transpackage/JavaTrans$2.class(in = 1330) (out= 731)(deflated 45%)
    adding: transpackage/JavaTrans$3.class(in = 611) (out= 392)(deflated 35%)
    adding: transpackage/JavaTrans$DemoAction.class(in = 2953) (out= 1567)(deflated
    46%)
    adding: transpackage/JavaTrans.class(in = 36020) (out= 15723)(deflated 56%)
    adding: transpackage/StepInfo.class(in = 1842) (out= 758)(deflated 58%)
    adding: transpackage/StreamRedirectThread.class(in = 2308) (out= 1238)(deflated
    46%)
    C:\Documents and Settings\iszalans\Desktop\JavaTrans>java -jar MyJar.jarException in thread "main" java.lang.NoClassDefFoundError: transpackage/JavaTrans
    Caused by: java.lang.ClassNotFoundException: transpackage.JavaTrans
    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)

  • Deploying Java Desktop App using executable JAR files

    Hi there.
    Today I am very optimistic about java. I am a beginner, and I had tried (in my few free time) to understand how to deploy java desktop apps.
    I am using the lattest NetBeans IDE to do the programming and it is very very fast and optimized.
    Going to the point, I tried some time ago to deploy an application (made with this IDE) using JAR files, but even though the application run well on my IDE, when I packed it, it rised an error saying that
    java.lang.NoClassDefFoundError: org/netbeans/lib/awtextra/AbsoluteLayout
    I was using an absolute layout on my JFrame forms and this AbsoluteLayout is provided by netbeans and not by the normal SDK.
    I then looked for the absolute layout class and found a jar file in the following path:
    C:\netbeans\modules\ext\AbsoluteLayout.jar
    So I mounted the Jar file in my File Systems and then added the contents of the file to myApp.Jar file.
    I used the automated Jar Recipe Packaging feature of netbeans, that is why I needed to mount the AbsoluteLayout.jar file into my file systems.
    Now it runs fine by just right clicking the MyApp.jar file from Windows Explorer.
    In a next reply to this topic I will include some sample code so that anybody requiring to do such implementation can take this for help.
    Regards!
    JN

    Well,
    I will take some time here to show the basic source code and procedure to create a desktop application, pack it up in a Jar file for deployment, add other classes or jars to the deployment jar file and finally open the jar file as an executable. This applies for either windows and linux environments.
    Take in count i am using Netbeans IDE 3.x (3.5)
    First I open the IDE and create a new project called MyDesktopApp. This is done by going to the menu Project / Project Manager. Then click on the New button and specify the project name and click on OK.
    At this point, the Filesystems tab in the project explorer is empty. So I mount a directory to store myDesktopApp in it. I selected c:\MyDesktopApp but you can select any name you want.
    To mount the directory you follow these steps:
    1. Right-click on File Systems
    2. From the contextual menu select Mount > Local Directory
    3. In the filechooser window, you just browse it and SELECT the directory to mount. Be aware that you can even create the directory on this window. Do not enter (double-click) into the directory you want to mount, just select it and click on finish...
    4.Then the directory entry appears under the filesystems node of the project explorer.
    Now you have to create your application. You can either create a package (special configured and tracked directory) or you can create the clases directly inside the directory. For tidy project, I will create the package.
    To create the package follow these instructions:
    1. Right-click on the mounted directory and from the contextual menu select New > Java Package
    2. In the New Wizard - Java Package window, type the package name and click on finish. I use the "MyDesktopApp" as package name.
    OK. Now the package is created under the mounted directory. Now we have to create the Main Class. In this case I will use a JFRAME as the main class but you can create any class you want.
    To create the JFRAME as main class follow these steps:
    1. Right click on the java package you just created and select New>JFRAME from the contextual menu. If you do not see the JFRAME option on the NEW sub menu you will have to select the All Templates option. I explain the All Templates option now on, it will be easier to use the JFRAME if available. Once you use JFRAME with the all templates then the JFRAME will show up in further NEW usage.
    2. So finally we used the All Templates, and you select the Java GUI Forms > JFRAME form option and click on NEXT.
    3. Give it a name. (I used MyDesktopAppFrm) and click on finish. Be aware you can set advanced options by clicking on next. But for the purposes of this topic we will use default options so click on FINISH
    4. A new JFRAME form appears inside your package. Right click on the form and select Set layout > Absolute Layout.
    5. Add some controls and code. I added a label and a button. And coded the ActionPerformed event of the button to say hello! on the label. this is up to you. The code just looks as follows:
    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    // Add your handling code here:
    jLabel1.setText("Hello folks!");
    6. Compile and execute the form.
    Let's say this is our Desktop Application. Now We will pack it in a Jar in two steps...
    A. Create a JAR file (Recipe)
    1. Right-click on your package and select New > All Tempaltes (Long Route) You can also select New > JAR Recipe if available.
    2. On the New Wizard Window, choose the JAR ARchives > JAR Recipe template and click on NEXT
    3. I used MyDesktopApp as the file name and Defaults and then click on Next.
    4. Specify the JAR Contents. Select the Package (not the mounted folder) from the mounted file system and click on add and then click on NEXT twice...
    5. On the JAR Manifest window, click on GENERATE
    6. Edit the manifest in the window to add the following code:
    Main-Class: MyDesktopApp.MyDesktopAppFrm
    7. Ensure the Main-Class definition is the same as your java package and JFRAME name. Click on FINISH
    8. At this point we have a jar file in your project directory but this file wont run because it is missing some Netbeans clases that we will add in the next set of steps... Just to check, compile the file (right click on the JAR file and compile) and try to execute. It must compile but must not execute.(well if it executes you are done. It may execute if you did not set the lay out of the form as AbsoluteLayout)
    B. Add the AbsoluteLayOut to the JAR
    1. Right click on File Systems and select Mount > Archive Files
    2. Look for your netbeans installation folder and select the following file:
    .../netbeans/modules/ext/AbsoluteLayout.jar
    3. Click on finish
    4. Now the JAR File is mounted in the file systems.
    5. Right-click on your MyDesktopApp.JAR file and select properties.
    6. Look for the contents property click once on it and then on its elipsis button [...]
    7. From the FileSystems box in the Contents window, select the AbsoluteLayOut file and click on Add
    8. Then the system asks you if you are sure. Of course you are so click OK. (If not sure, just read the message text and click OK...:-))
    9. Click on OK
    10. Compile your JAR Recipe (right click on it and Compile)
    11. Now you must be able to run the file by right clicking it and EXECUTE.
    12. Also you must be able to run the file by double clicking the file from a Windows Explorer. You may receive a message asking to select the program to run the file with. You must browse and select the Javaw.exe file in the bin directory of your Java RUn Time installation. This is typically located at C:\j2sdk1.4.0_01\jre\bin or something like that. Use the File-Search feature of window to locate the JAVAW.exe file if needed.
    I hope this long explanation helps somebody to deploy Java Desktop applications. Please reply the message if it helps you just to know it was useful.
    Thanks for your time....
    JN

  • I keep getting trojans in omni.jar file whenever I try to install latest Firefox.

    After downloading the latest version (5.0) my antivirus alerted me that the omni.jar file inside Firefox install folder had been infected with a trojan.
    I have disinfected my HD numerous times between every re-install of Firefox, and it's always the same thing. The trojan doesn't appear anywhere else unless I ignore it and it starts infecting other files.
    My question, is this perhaps because of the installer being infected? Appreciate if you would look into this matter.
    The trojan is TrojWare.JS.TrojanDownloader .Agent.~EWH@226922441 and it appears inside omni.jar, under
    chrome/toolkit/content/global/cpow/child.html and
    chrome/toolkit/content/global/plugins.html
    I use Comodo Antivirus
    I can provide a screenshot of the scan resault window.
    Thank You.

    This might be a false positive. There have been some discussions about that detection on the Comodo forums. I can't read all the posts, but maybe you have time?
    [https://forums.comodo.com/empty-t74144.0.html False Virus confirm this please?]
    [http://forums.comodo.com/antivirus-help-cis/help-after-new-update-t74101.0.html;msg528400#msg528400 Help after new update]
    [http://forums.comodo.com/empty-t74143.0.html;msg528464 Unresolved trojan]
    [http://forums.comodo.com/empty-t74116.0.html FP on TrojWare.HTML.Exploit.Codebase.~Exec@226875254 ?]

  • BiPub 10.1.3.4 upgrade:What jar files do I need to include in a chart proj?

    JDev 10.1.3.4
    BIPub 10.1.3.4 Build 129 desktop
    I have a series of reports with graphs which work by calling the xdo engine from a JDev designed web app. Worked fine with the previous version 562.
    I just upgraded the desktop tool and rebuilt an old graph. The tables work, but the graphs/charts do not. I assume it is a jar / lib compatibility issue.
    What jar files do I need to include in the project? What precedence do they need?
    Also, what is the difference between setting a library reference and putting the jar files in the Web INF directory?
    Thanks.
    Steve

    Just wanted to add to this ... I loaded BIPub Server 10.1.3.4 where I extracted the xdocore.jar from to put in my project. The report previews fine in there, both graphs and tables. Also works in Word.
    When I use the following code (which worked fine in previous version) the pdf opens with the table and an empty chart.
    Any ideas??
    Steve
    public String getPDF(java.sql.Connection jdbcConnection, String sqlOrDataXMLpath,
    Hashtable parameters,String templateXMLpath,OutputStream streamOut,
    String flgType)
    // create PDF and save in output path
    // flgType SQL or DD for sql or datadef
    // return error string if error
    try //convert rtf template to xsl
    // First store the xsl in a byte array input stream
    ByteArrayOutputStream xslOut = new ByteArrayOutputStream();
    RTFProcessor rtfProcessor = new RTFProcessor(templateXMLpath);
    rtfProcessor.setOutput(xslOut);
    rtfProcessor.process();
    byte[] b = xslOut.toByteArray();
    bais_xsl = new ByteArrayInputStream(b);
    // Next store the data in a byte array input stream
    ByteArrayOutputStream dataOut = new ByteArrayOutputStream();
    DataProcessor dataProcessor = new DataProcessor();
    dataProcessor.setConnection(jdbcConnection);
    if (flgType.equals("SQL"))
    { dataProcessor.setSql(sqlOrDataXMLpath); }
    else
    { dataProcessor.setDataTemplate(sqlOrDataXMLpath); }
    dataProcessor.setParameters(parameters);
    dataProcessor.setOutput("c:\\\\temp\\\\Test.xml");
    dataProcessor.processData(); //data is now in a file for debug
    if (flgType.equals("SQL"))
    { dataProcessor.setSql(sqlOrDataXMLpath); }
    else
    { dataProcessor.setDataTemplate(sqlOrDataXMLpath); }
    dataProcessor.setParameters(parameters);
    dataProcessor.setOutput(dataOut);
    dataProcessor.processData(); //data is now in dataOut stream
    b = dataOut.toByteArray();
    bais_data = new ByteArrayInputStream(b);
    // now do document merge
    FOProcessor processor = new FOProcessor();
    processor.setData(bais_data);
    processor.setTemplate(bais_xsl);
    processor.setOutput(streamOut);
    processor.setOutputFormat(FOProcessor.FORMAT_PDF);
    processor.generate();
    catch (IOException e)
    System.out.println("IOException:getPDF " + e.getMessage());
    catch (XDOException e)
    System.out.println("XDOException:getPDF: " + e.getMessage()) ;
    catch (SQLException e)
    System.out.println("SQLException:getPDF: " + e.getMessage()) ;
    return("Success");
    Edited by: user6357416 on Oct 24, 2008 11:55 AM

Maybe you are looking for

  • Theme download: bug or normal behaviour? Nokia 216...

    Hi there, my first post... Sorry for my bad english. I have a Nokia 2610 and I am quite happy with it if it wasn't for a nasty flaw: I wasn't able to download a single theme or ring tone. I have activated GPRS support, I have downloaded successfully

  • My iPod Video Plays video for a while the freezes

    Just got a question. I just bought an iPod 60gb 5th Gen. a week ago and I loaded up some videos in it. It seems that when I play the videos for about 5 mins it just goes to pause or freezes a while then when it starts playing again the sound does not

  • Anyone using Windows 7 RC on an R61 ? (Random freezing issues)

    My R61 will randomly freeze for 2-3 minutes during which time it becomes unusable as I cannot move the cursor.  All programs stop responding for 2-3 minutes and suddenly the computer will snap out of it and become usable again.  This will happen prob

  • A Broken ipod shows up in my screen

    Okay so my ipod is messed up.Some times when i plug it in it shows a broken ipod and under it it says" www.apple.com/support" but it dosent tell me what part of apple support to go to.sometimes it does charge and when im hearing music it frezes other

  • Cannot send AE Comp to AME

    None of the methods work for sending a composition to AME. Importing from AME gets stuck on the Dynamic Link window while "loading project.aep" and it never finishes. Using the command in the AE Composition drop-down simply does nothing at all. I see