Creating a simple jar file

I am trying to create a simple jar file for a swing application. I have used some third party api in the application.
However when i create a jar of the application using JDeveloper it seems to add all the third party class files too into the jar which i definately dont want. How do i do the same.

I presume you used a JAR deployment profile. Check the profile settings under "Dependency Analyzer". You might have checked there some jars you don't want to be included in the final package and the option "Include all of their contents..." is selected. Uncheck the ones you do not want to be included in the output archive.
Florin

Similar Messages

  • Java.lang.SecurityException using a simple jar file

    I created my small application using JDev 11.
    Running from JDev it works well.
    I created a simple jar file including all my classes and all libraries I used.
    Whe I try to run that jar file I get :
    java.lang.SecurityException: no manifiest section for signature file entry javax/mail/internet/AsciiOutputStream.classI didn't find any solution.
    I worked hardly with JDev 10g but I never had such problem.
    Tks
    Tullio
    Edited by: tullio0106 on Nov 25, 2008 2:22 PM

    I simply created a project containing some classes whish use java mail.
    Then I modified the project creating, in the deployment wizard, a "Dependency Analysis" filegroup adding all my classes as well as libraries.
    I uncheck the "Include Manifest" chek otherwise I would run into different problems (well documented in the forum).
    The jar file is created but when I run the application I get the Security error.
    If I remove java mail libraries (activation and java mail)from the list of used libraries and I add it to classpath it works fine.
    I suspect the problem could be in Manifes merging.
    Tks
    Tullio

  • Creating an exacutable jar file in netbeans

    Hey, how can i create an exacutable jar file in netbeans ?

    i guess you already have a project created, if you don't create a new java application project.
    Then you need to do the following:
    1. Set the main class. This is the class that will run first.
    for this you need to right click in the project node, select properties, then run and in the Main Class field put the main class.
    2. Set the classpath: you need to put all the libraries or resources you use in your project.
    to do that right click the libraries node, select properties, then add library and add all the libraries that your project needs
    by doing this steps netbeans will create your manifest file and the jar that will create will be executable.
    Hope this helps.
    Escobar5

  • How to create a client jar file???

    How do I create a client jar file for the client program? Please see my attached
    ejb-jar.xml. I compiled the my EJB and deployed it successfully. However, I couldn't
    find the client jar anywhere. I use the weblogic admin console DD editor, I can
    see that the edit field has been populated with my client jar file name defined
    in the ejb-jar.xml. However, I searched entire system, I could not locate this
    jar anywhere.
    How do I do that? If someone knows how to do it, please let me know. Thank you
    very much.
    [ejb-jar.xml]

    How do I create a client jar file for the client program? Please see my attached
    ejb-jar.xml. I compiled the my EJB and deployed it successfully. However, I couldn't
    find the client jar anywhere. I use the weblogic admin console DD editor, I can
    see that the edit field has been populated with my client jar file name defined
    in the ejb-jar.xml. However, I searched entire system, I could not locate this
    jar anywhere.
    How do I do that? If someone knows how to do it, please let me know. Thank you
    very much.
    [ejb-jar.xml]

  • Strip classes actually  used in a jar file to create a smaller jar file?

    I am creating a applet using java3d and the jar files add up to over 4meg ( j3dcore.jar j3dutils.jar vecmath.jar). Is there a way you can strip out only the classes your applet uses and create a smaller jar file so that the download isn't as big? Currently takes a long while for the applet to start because it downloads the Java 3D library in its entirety.

    Most likely those classes that you use also use other classes that you don't use ...

  • Unable to create an executable jar file

    Hi,
    I am unable to create an executable jar file,
    I am using the command as follows:
    C\> jar cvfm MyJarName.jar manifest.txt Demo.class
    where as Demo.class has appropriate main method; manifest.txt contains [ Main-Class: Demo ] and a new line
    Please help.
    thanks & regards
    M K Rayapudi
    Edited by: R6i on Apr 30, 2009 5:15 AM

    Your jar is perfectly generated, but your machine has a problem with .jar file associations.
    You have two options:
    1. Play with the registry. Dangereous if you are not used to.
    2. Reinstall the jre.
    Just to verify my theory, open a command prompt and the command:
    reg query HKCR\jarfile\shell\open\command
    What does it say? I have executed your command , here is the output
    HKEY_CLASSES_ROOT\jarfile\shell\open\command
        (Default)    REG_SZ    "C:\Program Files\Java\jre6\bin\javaw.exe" -jar "%1" %*I am not getting anything from this command, can you please explain clearly.
    thanks & regards
    M K Rayapudi
    Edited by: R6i on May 3, 2009 10:18 PM

  • 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 do I create an executable JAR File ?

    Hi,
    Let's say I have several Class Files that perform a special task.
    How do I bundle them in a JAR file and make it executable, so that the user simply types "prog.jar" and is happy.
    I wonder how that works, as I have to tell the starting point for execution.
    Does anybody now ?
    cu
    Oliver

    Three importants things to do :
    - don't forget to indicate in your manifest.mf the main class and the pacckage
    ex:
    Manifest-Version: 1.0
    Main-Class: mypackage.MyMainClass
    Created-By: 1.3.0 (Sun Microsystems Inc.)
    - don't forget to associate the .jar file with the application java.exe -jar -classpath %CLASSPATH%
    - don't forget to set the environment CLASSPATH correctly
    Hope this help
    Jean

  • How to create a running jar-file

    I created a "Java Class Library" project including 20 class files in several packages and some libraries.
    Because I would like to start the project from the console, I added the main-class property (right-click project, Properties, Run). Then I cleaned and built the project and tried to start it with the following command:
    java -jar PROJECTNAME.jarBut it won't work, because the archive is not complete: MANIFEST.MF lacks the main-class and all involved libraries.
    I managed to add the main-class attribute manually, but adding all library references seems to be very error-prone.
    So does anyone know if I did something wrong or if this is a bug of Creator?
    Regards,
    Felix

    The main intent of this project type is to provide a libraray which normally wouldn't run with a "main". I suggest you use NetBeans to create a "Java Application" project. Here's what is in the README.txt file produced with the jar. This looks like what you're looking to do. So you can create the Jar in NetBeans then if you want to use it in Java Studio Creator, you can add it to the Creator project. Also, if you caught the news at JavaOne, we are providing Creator features for a pack that will run in NetBeans so you won't have to switch back and forth between the tools. Keep an eye on the NetBeans and Creator web sites for more info.
    Thanks!
    -David
    README.txt
    ========================
    BUILD OUTPUT DESCRIPTION
    ========================
    When you build an Java application project that has a main class, the IDE
    automatically copies all of the JAR
    files on the projects classpath to your projects dist/lib folder. The IDE
    also adds each of the JAR files to the Class-Path element in the application
    JAR files manifest file (MANIFEST.MF).
    To run the project from the command line, go to the dist folder and
    type the following:
    java -jar "JavaApplication3.jar"
    To distribute this project, zip up the dist folder (including the lib folder)
    and distribute the ZIP file.
    Notes:
    * If two JAR files on the project classpath have the same name, only the first
    JAR file is copied to the lib folder.
    * If the classpath contains a folder of classes or resources, none of the
    classpath elements are copied to the dist folder.
    * If a library on the projects classpath also has a Class-Path element
    specified in the manifest,the content of the Class-Path element has to be on
    the projects runtime path.
    * To set a main class in a standard Java project, right-click the project node
    in the Projects window and choose Properties. Then click Run and enter the
    class name in the Main Class field. Alternatively, you can manually type the
    class name in the manifest Main-Class element.

  • Creating War , not Jar file.

    I am trying to create my EJB and i created my web project. The problem seems that my JBoss will not recognize and deploy my table perhaps due to the structure of the war file.
    My entities are working perfectly as they work, and have already been tested.
    ANyway, what i want is some help into getting my build.xml into making a jar file and sending that one instead of the the war file..
    Can someone please let me a link of where i should look ? Or what i should include in the xml file in order to create the file
    sTevoo.
    P.s - I am using netbeans 6
    Ps - I wasnt sure if i had to post here or in the Deploying - Java Archive (JAR) Files

      <property name="jboss.deploy.dir" value="/home/stevoo/jboss-4.2.2.GA/server/default/deploy"/>
        <property name="librarydir" value="${basedir}/lib"/>
        <property name="src.dir" value="src"/>
        <property name="build.dir" value="build"/>
        <property name="dist.dir" value="dist"/>
        <property name="bin.dir" value="bin"/>
        <target name="prepare">
            <delete dir="${bin.dir}"/>
            <mkdir dir="${bin.dir}"/> 
            <mkdir dir="${bin.dir}/META-INF"/>
        </target>
        <!--Set Libs-->
        <path id="libraries">
            <fileset dir="${librarydir}">
                <include name="*.jar"/>
                <include name="*.zip"/>
            </fileset>
        </path>
        <target name="compile1" depends="prepare">
            <javac srcdir="${src.dir}" destdir="${bin.dir}">
                <classpath refid="libraries"/>
            </javac>
            <echo message="Compile ...." />
        </target>
        <target name="compile" depends="compile1">
            <copy file="${src.dir}/conf/log4j.properties" todir="${bin.dir}/META-INF/"/>
            <copy file="${src.dir}/conf/MANIFEST.MF" todir="${bin.dir}/META-INF/"/> 
            <copy file="${src.dir}/conf/persistence.xml" todir="${bin.dir}/META-INF/"/>
            <jar basedir="${bin.dir}" destfile="${dist.dir}/test.jar"/>
            <echo message="Build...." />
        </target>
        <target name="run" depends="compile">
            <copy file="${dist.dir}/test.jar" todir="${jboss.deploy.dir}"/> 
            <echo message="Run ... ${jboss.deploy.dir}"/>
        </target>
        After a whole day of changing and tweaking and all .... this sort of works.
    Some more tweakong and done.
    Just in case any one else wants this,,,

  • Creating a weblogic.jar file?

    I am looking to minimize my client size java app, which makes use of EJBs.
    I am using the verboseToZip utility that is described at:
    http://www.weblogic.com/docs51/techdeploy/verbosetozip.html
    It has reduced the size of the jar from 35MB to about 700K. The application
    has problems starting up, however. I get the exception shown below. Any
    idea what this means? I looked in the jar file, and sure enough there are
    classes in a directory named: com/rsa/jsafe. The error occurs when getting
    the EJB home object (at the start of the application).
    Thanks,
    Mike
    ------------------------------------------Exception-------------------------
    Exception in thread "main" java.lang.NoClassDefFoundError:
    COM/rsa/jsafe/JSAFE_InvalidUseException
    at
    weblogic.security.WLMessageDigest.getInstance(WLMessageDigest.java:53)
    at
    weblogic.security.MD5RandomBitsSource.seed(MD5RandomBitsSource.java:56)
    at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:108)
    at weblogic.rjvm.LocalRJVM.getLocalRJVM(LocalRJVM.java:85)
    at weblogic.rjvm.RJVMManager.getLocalRJVM(RJVMManager.java:89)
    at weblogic.rjvm.RJVMManager.initialize(RJVMManager.java:78)
    at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:137)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:182)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:195)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:148)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:123)
    at
    javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:198)
    at
    com.ecocap.daemon2.dbthread.setupContextAndObjects(dbthread.java:1064)
    at com.ecocap.daemon2.dbthread.<init>(dbthread.java:48)
    at com.ecocap.daemon2.DaemonFrame.<init>(DaemonFrame.java:45)
    at com.ecocap.daemon2.daemon.<init>(daemon.java:27)
    at com.ecocap.daemon2.daemon.main(daemon.java:184)

    Don,
    Thanks for responding so quickly. You are correct - I am on Windows. I
    didn't realize it was a case sensitivity problem. Anyway, I took your third
    option, since it was the least painful for me and everything worked.
    Thanks,
    Mike
    "Don Ferguson" <[email protected]> wrote in message
    news:[email protected]...
    Let me guess: this is on Windows. I bet the problem concernscase-insensitive
    file names. When creating the client jar, a "com" directory was created.When
    it came time for the COM directory, Windows just treated it as equivalentto
    "com". However java does not. There are a variety of solutions:
    a) use Unix to build the client jar
    b) use ant to extract the appropriate subset of classes from weblogic.jarwhen
    creating the client.jar (bypassing the filesystem).
    c) move the COM stuff to a separate directory tree, and use somecombination of
    jar -C or jar -u to create the client.jar.
    Don
    Michael DiChiappari wrote:
    I am looking to minimize my client size java app, which makes use of
    EJBs.
    I am using the verboseToZip utility that is described at:
    http://www.weblogic.com/docs51/techdeploy/verbosetozip.html
    It has reduced the size of the jar from 35MB to about 700K. Theapplication
    has problems starting up, however. I get the exception shown below.Any
    idea what this means? I looked in the jar file, and sure enough thereare
    classes in a directory named: com/rsa/jsafe. The error occurs whengetting
    the EJB home object (at the start of the application).
    Thanks,
    Mike
    ------------------------------------------Exception-------------------------
    Exception in thread "main" java.lang.NoClassDefFoundError:
    COM/rsa/jsafe/JSAFE_InvalidUseException
    at
    weblogic.security.WLMessageDigest.getInstance(WLMessageDigest.java:53)
    at
    weblogic.security.MD5RandomBitsSource.seed(MD5RandomBitsSource.java:56)
    at weblogic.rjvm.LocalRJVM.<init>(LocalRJVM.java:108)
    at weblogic.rjvm.LocalRJVM.getLocalRJVM(LocalRJVM.java:85)
    at weblogic.rjvm.RJVMManager.getLocalRJVM(RJVMManager.java:89)
    at weblogic.rjvm.RJVMManager.initialize(RJVMManager.java:78)
    at weblogic.kernel.Kernel.ensureInitialized(Kernel.java:137)
    at weblogic.rjvm.ServerURL.findOrCreateRJVM(ServerURL.java:182)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:195)
    at
    weblogic.jndi.WLInitialContextFactoryDelegate.getInitialContext(WLInitialCon
    textFactoryDelegate.java:148)
    at
    weblogic.jndi.WLInitialContextFactory.getInitialContext(WLInitialContextFact
    ory.java:123)
    at
    javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:668)
    at
    javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:246)
    at javax.naming.InitialContext.init(InitialContext.java:222)
    at javax.naming.InitialContext.<init>(InitialContext.java:198)
    at
    com.ecocap.daemon2.dbthread.setupContextAndObjects(dbthread.java:1064)
    at com.ecocap.daemon2.dbthread.<init>(dbthread.java:48)
    at com.ecocap.daemon2.DaemonFrame.<init>(DaemonFrame.java:45)
    at com.ecocap.daemon2.daemon.<init>(daemon.java:27)
    at com.ecocap.daemon2.daemon.main(daemon.java:184)

  • Creating an Executable jar file

    Hello ! I have a application that has been fully developed and all i want to do is to create an executable file using my own icon so that whenever it is double clicked it opens up the appliation.
    Please provide an example fro easy refrence.
    Thanks

    i have the procedure for creating executable jar file in a separate file.
    if u r interested then mail me at:
    [email protected]
    regards
    Md. Afroze

  • Creating an executable jar-file including a custom package

    I am trying to learn how to create executable jar-files. I have managed this with a single class. However having a class which is an extention of another class which in turn belongs to custom package, I can't make it work.Running the program normally is not a problem. I don't think the problem is the actual code, but I will include it here anyway. I create the jar-file using:
    jar -cmf Direkt2b.txt Direkt2b.jar *.class
    where Direkt2b.txt is just:
    Main-Class: Diriekt2b
    Only the main class-file is included this way. Copying the other file to the same directory before creation doesn't help either. There is no error messages, the jar-file just refuses to run no matter what.
    The main-class:
    import java.awt.*;
    import extra.*;
    class Direkt2b extends ExtendedFrame {
         Font f;
         Direkt2b() {
              f = new Font("SansSerif", Font.BOLD, 24);
              setBackground(Color.yellow);
              setSize(400,150);
         public void paint(Graphics g) {
              g.setFont(f);
              g.setColor(Color.blue);
              g.drawString("V?lkommen till Java Direkt", 45, 100);
         public static void main (String[] arg) {
              Direkt2b d2 = new Direkt2b();
              d2.setVisible(true);
    The help-class:
    package extra;
    import java.awt.*;
    import java.awt.event.*;
    public class ExtendedFrame extends Frame {
         private static boolean first = true;
         private boolean isFirst = first;
         public ExtendedFrame() {
              addWindowListener(theListener);
              first=false;
         WindowAdapter theListener = new WindowAdapter () {
              public void windowClosing(WindowEvent e) {
              dispose();
              if (isFirst)
                   System.exit(0);
    }

    My problem wasn't really getting more than one class in a jar-file,
    but rather that my jar-file with multiple classes wouldn't execute.
    Reading the original post I realized that maybe I was unclear about that.
    However I have solved the problem now so for anybody reading this
    thread in the future I will tell you how.
    The general setting is this: You have a bunch of self-made help-classes
    organized in some classdirectory somewhere in the filesystem. You use these
    in your programming from time to time. You have set a classpath-varible
    in your OS such that Java could find your help-classes.
    Now you want to create executable jar-files so that you could publish your work.
    My problem was that while I added all needed classes in a jar-file, the main-class
    couldn't find the others because they were referenced incorrectly. The solution I
    came up with may not be elegant, but it works. I copied the main-class and all directories
    (only one in my case) just as they appear in the classpath-directory, to the same temporary
    directory. Then I created the jar-file from there, using: jar -cmfv Direkt2b.txt Direkt2b.jar Direkt2b.class extra/*.class
    I suspected that incorrect referencing was the problem and I tried several variations on the theme above
    before giving up and writing the first post. Part the problem was that I didn't get any error messages,
    just an annoying error-sound double-clicking the jar-file. I learned later that you could run jar-files from
    the command -prompt using: java -jar myjarfile.jar. This way you get a more useful response.
    I guess there is a way to include the classpath instead somehow, but I will use my method for now.
    I hope this was helpful to somebody.

  • Create a complete jar file with jscreator

    Please provide all details for creating a jar file with jscreator for this 77 year old puzzle creator

    Hi,
    I would suggest switching to NetBeans IDE. It allows for the following:
    - Ability to run with latest JDK release
    - Enabled with the latest Java technologies
    - Support for a greater number of application servers
    The following will help with migration (if you already have a project setup in Creator)
    http://www.netbeans.org/kb/60/web/creator-migration.html
    Also, the following article describes how to create and Distribute Executable JAR Files in NetBeans
    http://www.netbeans.org/kb/articles/javase-deploy.html
    NetBeans website for downloads and other information;
    http://www.netbeans.org/index.html

  • Creating Pages using jar file

    When I wrap up my JAR file (contains JSPs and classes) and use the portal interface to upload to a JAR file and point to the main JSP page - when I run it, it cannot find the class files that should be wrapped inside the JAR file. I can't find ANY documentation on how to do this, so any help would be appreciated. Thanks.

    From the PDK article Java Server Pages Support In Oracle9iAS Portal, located on Portal Center:
    In the current version of Portal, the support for JAR files is limited to the JAR files that have a set or combination of JSP pages, HTML files, and image files. No class files placed in a JAR file will be recognized by the container. As a workaround, you can put your class files in the /WEB-INF/classes directory.

Maybe you are looking for

  • Asset negative posting not allowed

    Hi We are running ECC 6.0 with EP3. While data migration certain Assets like Land was uploaded with overstated value. The depreciation key used is SLM 0%. Now Auditors are here and negative adjustment of actual asset value is required. For this purpo

  • *Maximum report in one report group (report painter)*

    Hi SAP Experts, I'm doing some job on report painter, issue on this is the number of reports in one report group,because in my case I can only insert 7 reports in one report group. Is there any possible way to extend the maximum report allowed in one

  • ICloud will immediately delete the emails once a sync has occurred

    As the tiltle shows, since yesterday, all emails goes to iCloud will immediately delete the emails once a sync has occurred. Sent emails will be kept into place, but I keep losing incoming Emails. Please help. Regards, Anning

  • Ipod touch 5 lagging while charging

    I've had my ipod touch 5 since November 22nd, 2014. Every time I charge it, it lags whether that is while I am using an app or just trying to enter my passcode. I've tried not having apps run in the background but it still lags. If I use an app, it s

  • /ccm/minimum_quantity

    Hai All, when I try to upload /ccm/minimum_quantity characteristic via CSV file to supplier catalog, the system gives error message. However when I entered it manually in procurement catalog, it is fine. How to upload this characteristic via CSV file