How to create a JAR

Hi
I'm very new to Java. I have a private project to do a little admin application for bulk changes to my itunes library via their COM API. Previously I used several javascripts to do this so I don't expect a lot of work to adapt them to Java. I use eclipse and have downloaded com4j (https://com4j.dev.java.net/servlets/ProjectDocumentList) to create wrappers to the COM-objects in iTunes. the quick intro to com4j say that the wrappers are created by the tlbimp.jar. I know that JAR is a a java archive created by jdk using jar.exe but I can't get out a tlbimp.jar file how much i try. If I do something like this
jar -cvf tlbimp.jar *
Does that make sense? What prerequisites are important? Does jar.exe have to be in som path variable in windows? Should I be in the folder where the classes are or one level up? Anything else
Edited by: 802710 on 2010-okt-15 03:16

802710 wrote:
Hi
I'm very new to Java. I have a private project to do a little admin application for bulk changes to my itunes library via their COM API. Previously I used several javascripts to do this so I don't expect a lot of work to adapt them to Java. I use eclipse and have downloaded com4j (https://com4j.dev.java.net/servlets/ProjectDocumentList) to create wrappers to the COM-objects in iTunes. the quick intro to com4j say that the wrappers are created by the tlbimp.jar. I know that JAR is a a java archive created by jdk using jar.exe but I can't get out a tlbimp.jar file how much i try. If I do something like this
jar -cvf tlbimp.jar *
Does that make sense? What prerequisites are important? Does jar.exe have to be in som path variable in windows? Should I be in the folder where the classes are or one level up? Anything elseIt sounds to me like the documentation is saying that Java classes in the tlbimp.jar are used to create the wrappers - you do not need to create that jar. I bet if you look at the zip file you downloaded, you will find tlbimp.jar inside the zip file. You need to extract that jar and any other jars inside the zip file and configure Eclipse to use them.

Similar Messages

  • How to create a .jar file in wlcs3.1

    hello friends,
    hi friends, im working on weblogic commerce server3.1 . i dont know how to create a .jar file in weblogic commerce server3.1. can any one knows send email to me.
    thanks.
    hari

    $JDK_HOME/bin/jar (%JDK_HOME%\bin\jar) shows you the syntax
    where JDK_HOME is your jdk installation directory.
    Kumar
    hari wrote:
    hello friends,
    hi friends, im working on weblogic commerce server3.1 . i dont know how to create a .jar file in weblogic commerce server3.1. can any one knows send email to me.
    thanks.
    hari

  • How to create executable jar files??

    how to create executable jar files??
    thx :)

    Using JAR Files to Deploy
    http://developer.java.sun.com/developer/onlineTraining/Programming/BasicJava2/jar.html#jar

  • How to create a .jar file for the BPEL project

    hi all,
    how can i create a .jar file for my BPEL project, i am trying to deploy the project but getting an error :
    "Error: [Error ORABPEL-10902]: compilation failed [Description]: in "C:\OraBPELPM\integration\jdev\jdev\mywork\Workspace_BPELDemo\BPEL_Report\BPEL_Report.bpel", XML parsing failed because "". [Potential fix]: n/a. "
    and when doubel cliking on this error Jdev take me to the beginning of the ".bpel" file.
    I 'm really stuck in here i am not able to deploy the process!
    Thanks,
    Rana

    Rana:
    If you haven't already, I would post this question in the BPEL forum. I would expect a much better turnaround there.
    Johnny Lee

  • How to create a jar file which is in the remote system?

    Hi,
    I have a set of files that resides in a remote system,which have to be "jar"red. I have a firewall in between. I want to create a jar file out of the files situated in the remote system.How do i go about this process.?

    Hi,
    You can't do that in a simple way. You need to have a port open in the firewall, and you need to have a server process on the remote machine.
    Kaj

  • How to create a Jar with only class files?

    Dear all,
    I want to create a jar file with only classes.My class files and java files are in different folders under com .
    say
    com
    in com there are two folders
    folder 1 -- subfolder 1
    folder 2 -- subfolder 2
    like this.
    If i want to create a jar file from com directory how should i give the jar command.Again my jar should contain only .class files.
    Any help will be appreciated
    Thanks
    lekshmi

    It doesn't work.Says "No such class or directory"
    Any other way Or is it possible to do so?Read the link I posted and create the statement to make your structure. I was thinking you were inside the com directory but if you are above it you will need something like this instead:
    jar -cf test.jar com\*.class com\subfolder1\*.class com\subfoler2\*.class
    But either way don't just copy and past this. Think about what is does so that you can make it work for you.
    Also, you might want to look into using Ant if you are going to be building this a lot.

  • How to create a Jar files

    I m New in java i want to create a jar files but i dont know how please anyone help me and answer my question thanks.

    Hi muhammadawood,
    Creating a jar file is easy. First of all, a jar file is not much more than a zip file. You can use your favorite zip program (ie. zip, WinZip, pkzip, etc) to create the jar. To do this, zip all your classes together into a zip file. Then, rename the file w/ a .jar extension. This method doesn't support a small set of features defined by jar, but it will work nonetheless.
    If you are using the Forte IDE, it has the ability to create a jar from a menu.
    Regards,
    Nick G.

  • How to create sbconfig.jar automatically?

    Hi All,
    I have a osb project in SVN(subversion).what i want is to check out the osb project from SVN and create sbconfig.jar ,and than deploy this jar to OSB server...
    But i want this whole process to be automated.. ie using script...
    does any one how idea how can i do this?
    Regards
    Rohan

    Hi Rohan,
    OSB is configuration based product hence you may not be able to build jars using artifacts like .proxy and .biz files. Scripts work only in conjunction with server.
    You may refer -
    Create sbconfig.jar for OSB project using script
    Regards,
    Anuj
    Edited by: Anuj Dwivedi, TCS on Jul 22, 2010 12:32 PM

  • How programmatically create a jar?

    How do I create a jar from inside java class?

    thanks rsully! That def. helped. Here's the complete program:
    http://forum.java.sun.com/thread.jsp?forum=22&thread=196383

  • How to Create a jar war or ear--Probelms in deploying

    I have the following dir structure. I am using Struts 1.1 and weblogic 7.0
    APP
    +jsp
    +WEB-INF
    + ---lib
    +--- classes
    +----com
    --ap
    --action
    --beans
    --handler
    --service
    --client
    --ejb
    --valueobject
    1> Do I need to create a ear file since i want both the ejb (under service folder) and war as reusable components. Whenever we have a EJB component do we always need to have an EAR file??
    2> Whats the best way to create the jar, war or ear file. I am facing great difficulty in deploying the war.Do we need to set any classpath before we create the war and jar files except for the deployment descriptors.I have created the ejb descriptors correctly through ejbc.
    3>I have kept struts.jar,log4j.jar under lib folder. However when i create the ear and try to deploy it under weblogic it deploys the war file but gives error in deploying the jar which has the ejb. I have aslo validated the jar using ejbc.
    It gives error indicating that it requires struts.jar in classpath. If we give the classpath of struts.jar at system leve the Application deploys with ease..Can anyone tell whats the error.The jar does not use any strust component .
    4>Also the valueobject which has some beans which are used to populate the jsp through Actionformbean. Is it ok if we give refrences in both ejb jar and war?
    ie while creating jar and war folder have the valueobject in both the files or will it lead to any errors..
    Thanks in Advance
    ....

    Yes, I have tried that. But, as the server is running and the jars are in use, it throws and EditFailedException

  • How to create executable jar in eclipse using linking in compiler

    Hi,
    I have a project in Eclipse. I wrote already an ant build file for creating an executable jar which includes all project files.
    Now I want to create a second executable jar which is a subset of the project (a limited number of classes are necessary).
    I have a main class and I was looking for a way to generate a jar file which includes the main class and all the depending classes.
    Is there a way to do it? With ant or with another tool?
    Is it possible to compile a project given a main class, and include all depending classes?
    Regards,
    Biebel
    Edited by: biebel1975 on Jan 7, 2009 10:21 AM

    biebel1975 wrote:
    Some more information:
    When I compile all the classes, the jar file is +/- 3.5Mb inclusive the server side logic.
    The subproject I want to build, should be less then 1Mb (Only some screens and beans, no business logic ((only +/- 10% of the projects code) )).
    My question is: How can I create a executable jar with only the necessary class files which depends on the main class. (Linked with the imports).
    Is there a tool to do that? Can it be done with an ANT script? If so, how does the script looks?
    What are you talking about?
    You already said that you are using Ant.
    Ant uses script files.
    Since you have one with X items in it and you want something new with X-Y items in it the obviously it would make sense to construct an ant script that does less than the other ant script.
    The following provides a huge amount of information about Ant.
    [http://ant.apache.org/resources.html]
    Other than that no one can tell you want your Ant script will look like except that it will do less than the one that you already have.

  • How to create a jar file as a library in java?

    Let me put it simple: rb.java is already put under /home/jiane/rb/rb.java;
    the tar file rb.tar being located under /mylib/rbcore/, the test client is put under /home/jiane/test.java. now rb.java looks like
    //// rb.java
    import java.until.*;
    public class rb {
    %>jar cvf /mylib/rbcore/rb.jar /home/jiane/rb.class
    test.java as below
    //// test.java
    import mylib.rbcore.*;
    import java.until.*;
    class test {
    %>export CLASSPATH="/mylib/rbcore/rb.jar;."
    %>javac test.java
    %>test.java:1 package mylib.rbcore does not exist
    so, how to make adjustment to rb.java & test.java so that I can make use of jar file rb.jar. please shows the steps to do. thanks a lot.

    import mylib.rbcore.*;This assumes the package mylib.rbcore and imports all its classes.
    But the source of the class does contain package statement, so the class is in the default package.

  • How to create a jar having the contents of the jar in a byte array?

    Hi,
    I have a server and client application. My server returns the contents of the jar in the form of byte array to the client on a particluar method call. Now at the client end, i want to reconstruct the jar to be used. How do I do this?
    The server uses the JarInputStream to read the contents of the jar to be returned. I have tried using the JarOutputStream, but looks like this works fine if we have spearate class files to be added to the jar. Now that I have the contents of the jar itself, how do i recreate the jar?
    Can anyone please help me with this?
    Thanks
    Rajani

    Have you ever gotten the raw byte copy to work? If so, how?
    I download a jar via InputStream and save into a jar file via fileoutputstream. It always gets corrupted in the process. The new Jar file has the exact same number of bytes, but doesn't get past the Manifest on a -tvf. In fact, Winzip can open it fine, but can't extract. So close...yet so far.
    Here is a snapshot of my code:
    BufferedInputStream data1=new BufferedInputStream(con.getInputStream());
    DataInputStream data=new DataInputStream(data1);
    StringBuffer buf=new StringBuffer();
    try{
    while((theChar=data.read()) != -1)
    { buf.append((char)theChar); }
    } catch (Exception z){ logger.info("UpdateThread.read Done Reading jar file");}
    data.close();
    File newFile = new File("C:/MyJar.jar");
    FileOutputStream outstream2 = new FileOutputStream(newFile);
    DataOutputStream outstream1 = new DataOutputStream(outstream2);
    BufferedOutputStream outstream = new BufferedOutputStream(outstream1);
    byte [] bytes = buf.toString().getBytes();
    logger.info("Bytes of new Jar file = " + bytes.length);
    int i;
    for(i=0;i<bytes.length;i++){
    outstream.write(bytes);
    outstream1.close();
    outstream.close();
    Any ideas where I'm going wrong?

  • How to create runnable JAR in Eclipse

    I have a project in Eclipse with many classes.
    Whenever I try to create a runnable JAR, the JAR file created always contains all the classes of the project, regardless whether they are really used or not.
    Is it possible to create a runnable JAR in Eclipse, excluding the classes of the project which are not strictly necessary for a given launch configuration?

    krige wrote:
    I have a project in Eclipse with many classes.My condolences on using a build system that apparently has grabbed you by the short & curlies. That can be painful.
    Note that:
    1) Eclipse can use Ant style build.xml files for controlling most aspects of a build (that are worth mentioning).
    2) We provide no support for Eclipse on these groups, but since Ant typically defers to a core set of tools in the SDK, you can usually get away with asking an Ant related question.

  • How to create a jar, deploy and run it

    I extract the example bmp-simple.ear into class file and xml files.
    I create jar by the command
    jar cvf bmp-simpleEjb.jar META-INF samples
    (The java program are in package samples.ejb.bmp.simple.ejb; ) Suitable xml are stored in directory META-INF.
    Finally I jar all the jars into a bmp-simple.ear file, I can deploy it by admin console in j2ee 1.4, but when I run it, the following errors are shown
    I:\jdk14b\domains\domain1\applications\j2ee-apps\bmp-simple>appclient -client bm
    p-simpleClient.jar -name StorageBinClient -textauth
    Mar 23, 2004 4:19:52 PM com.sun.enterprise.appclient.Main <init>
    WARNING: ACC003: Application threw an exception.
    java.lang.ClassNotFoundException:
    at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
    at com.sun.enterprise.appclient.Main.<init>(Main.java:365)
    at com.sun.enterprise.appclient.Main.main(Main.java:105)
    If I create ear file from sun 's jar file, I can run it.
    If I create ear file from class and xml, I cannot run it
    The server I am using: J2EE(TM) Application Server 1.4 Developer Release (build b44-dr)
    Thanks for any help! (I repost and rewrite this question)

    please see the response to your question yesterday.

Maybe you are looking for

  • How can I install Windows on my new Mac?

    This question sounds simple, but I am going nuts. I got this MacBook Pro recently, and I need Windows (to run ArcGIS 10). I know it can be done, and in fact is very common. However, I'm stuck. Here are the problems: - Only Windows 8.1 is currently av

  • Cannot view streamed photos in web browser

    I have set up a photo stream from my iPhone and have set it up as a "Public Website" so that friends and family that do not have Apple devices can view the photos. Everything was working fine for about two months, but in the past couple of days peopl

  • Displaying columns in JTable

    Hi guys, i'm using 'setDataVector' method to populate my JTable. JTable table = new JTable(); DefaultTableModel dtm = (DefaultTableModel)table.getModel(); dtm.setDataVector(RowData [][], columnLabels[]); But in this way it only shows the row data (i.

  • Urgent..Audio-Video Conferencing

    Hi, I am new to this topic. I wanted to know that is it possible to do audio or video conferencing using java Technology. If yes, can you provide me some links to resources doing that.? Thanks in advance regards Jitendra

  • Help! Lost all my data!

    I saved my work then restarted my computer. I tried to re-open Iweb but it said that it needed a domain, it said domain.sites is not valid or something. I was trying to choose one but I didnt understand what it wanted me to choose. All of the sudden