Jar utility to a program

Hi
If i created a jar utility with jar command..
after jar files is being created how can i add that particular jar utility in a program...
Did any one know please give me some tips and tricks to start...

Include the JAR in your classpath, and then just reference the classes inside as normal.
ex. if the inside of your jar looks like:/...
    META-INF/
    com/...
          wombat/...
                    MyClass.classthen you can just import com.wombat.MyClass; in other code.

Similar Messages

  • Is there a way to add jar file in my program

    sorry to botter you, but i really need help for this, i really dont know how to do it. i have my prog taht i want to put in jar file, that cause no problem, but my program isnt fully functionnal because he use a jar file (my driver to acces my database) taht i had mount in forte. but i cant put in in my class file, because i want my jar to be able to run everuwhere on any computer taht have the jre installed. so in resume, i want to add jar file in my program... can i have to add it in my jar file, or decomrpesse it and put the folder like org.postgre.mfileshere... ????? i really dont know
    thx to help me

    ok If I understood, you need to add a third part Jar
    file to your own Jar File App so...
    Yes, you can decompress it in a directory tree and
    merge it with your application (i.e) if you have a jar
    file like this:
    br.com.yourApp.util
    and a third part jar file like this:
    br.com.thirdPart.tools
    br.com.thirdPart.util
    you will have these directory trees:
    br/com/yourApp/util/
    br/com/thirdPart/tools/
    br/com/thirdPart/util/
    then you can marge it in a unique tree:
    br/com/yourApp/util/
    ....../thirdPart/tools/
    ................/util/
    then you can make a new jar file with it...
    .....OR YOU CAN ADD THE PATH where your JDBCDrive is
    placed to the classpath of your application just using
    the -classpath option execution string of you
    application, like this:
    C:\jreHome\bin\java.exe -jar -classpath
    .;C:\someDir\thirdPart.jar yourApp.jar
    That's the better way to do it and then everything
    will work! :-)
    []'s Igor
    Brazil * * * * *k thx, ill give a try, and give you result later. but can you answer me another question, why when i double click on any jar file executable, sometimes javawa start but do nothing, sometimes they start and said no main class find, sometimes dotn start anymore, and sometimes work perfectly...?? is the jdk taht is not good? i use the last one
    or problem with my instalation, or the prog i try to run?
    thx

  • OIM 11g - Upload Jar Utility

    Hi All,
    I have installed the OIM-AD OOTB Connector. I am not able to run the UploadJars.bat Utility.
    For copying the "ldapbp.jar" File requires to run the "UploadJars.bat". I have set the WL_HOME env variable. And i have copied the jar "ldapbp.jar" to a temporary directory.
    When i am executing the bat command i am getting the error as "System cannot find the path specified".
    Urgent help is highly appreciated.
    Thanks in Advance,
    Sandeep D

    u must edit uploadjar.bat file...
    set JAVA_HOME=@java_loc
    set CLIENT_CLASS=oracle.iam.platformservice.utils.JarUploadUtility
    "%JAVA_HOME%\bin\java" -cp %CLASSPATH% -Djava.security.auth.login.config=%XEL_HOME%\config\authwl.conf -DXL.HomeDir=%XEL_HOME% -Dlog4j.configuration=file:"%XEL_HOME%\config\log.properties" -Djava.net.preferIPv4Stack=true %EXTRA_SYS_PROPERTIES% %CLIENT_CLASS% %*
    edit like this
    set JAVA_HOME=@java_loc
    set CLIENT_CLASS=oracle.iam.platformservice.utils.JarUploadUtility
    "C:\Program Files\Java\jdk1.6.0_24\bin\java" -cp %CLASSPATH% -Djava.security.auth.login.config=%XEL_HOME%\config\authwl.conf -DXL.HomeDir=%XEL_HOME% -Dlog4j.configuration=file:"%XEL_HOME%\config\log.properties" -Djava.net.preferIPv4Stack=true %EXTRA_SYS_PROPERTIES% %CLIENT_CLASS% %*
    Message was edited by: satish.ygl
    Message was edited by: satish.ygl

  • Writing into a jar file through Java program

    Is there a way to get a file from a jar (for ex. a properties file) make changes to it on the fly and write the same file back to the jar through a Java program?

    I cannnot give u exact code as i am bit busy..but i am giving close to exact
    below is code for reading contents of jar file
    import java.io.*;
    import java.util.jar.*;
    public class JarRead {
    public static void main (String args[])
    throws IOException {
    if (args.length != 2) {
    System.out.println(
    "Please provide a JAR filename and file to read");
    System.exit(-1);
    JarFile jarFile = new JarFile(args[0]);
    JarEntry entry = jarFile.getJarEntry(args[1]);
    InputStream input = jarFile.getInputStream(entry);
    process(input);
    jarFile.close();
    private static void process(InputStream input)
    throws IOException {
    InputStreamReader isr =
    new InputStreamReader(input);
    BufferedReader reader = new BufferedReader(isr);
    String line;
    while ((line = reader.readLine()) != null) {
    System.out.println(line);
    reader.close();
    now here say u have test.jar which contains test.txt (file)
    then
    java JarRead test.jar test.txt
    will print content of text.txt
    now in ur case u write content of each file in some other file modify it there and then create a jar file from those files using jaroutput stream .....
    this may not be all clear ..but what to do..bit busy...u are welcomed to make changes in above stratergy....n queries if any after using above stratergy and/or your great brain...

  • JAR utility problem

    Hi everyone,
    I've got this little problem, whenever I use the JAR utility program to list the contents of a .jar file or to extract its content, it just freezes up!
    Now even if I wait long enough, it does nothing.

    Try an unzip program - the jar is probably corrupted.

  • Is it possible to run a jar file in another program???

    Hello members,
    i am sanketh. is it possible to run a jar file in another program.
    if possible plz reply with an example or good links to go thru.

    What do you mean "run a jar file in another program"? It's not very clear.

  • Is it possible to verify a signed jar-file from a program?

    Is it possible to verify a signed jar-file from a program
    (using some API) likewise jarsigner does?

    Is it possible to verify a signed jar-file from a
    program
    (using some API) likewise jarsigner does?Hi,
    You would have to open the jarfile, read each jar entry and for each of them do a getCertificates() and then in turn verify each certificate with the public key of the enclosed certificates in the jar file.
    An easier solution would be to use the verify flag of the JarFile or JarInputStream.
    Hope it helps..
    Cheers,
    Vijay

  • Jar utility

    My operating system is unix. How do I unpack a WAR file using the jar utility? what is the usage?
    Thanks

    WAR files are JAR files. You can either use jar or unzip to unpack them.
    e.g.
    jar -xvf <mywarfile.war>
    or
    unzip <mywarfile.war>
    Type jar without options to see a brief description of valid options.
    Andy Nguyen

  • Jar utility silently failing on update

    Hi,
    I am trying to run a script that adds a single file to an existing WAR archive by executing the following command:
    jar uf las.war WEB-INF/classes/las.properties
    When I try this, jar fails to do the update and returns an exit code of 1, but doesn't print any error message. Using the "-v" option doesn't give any additional information.
    I can't find any Sun documentation on the return codes of the jar utility. I've double-checked the file permissions and the filenames and they are fine. I can extract the contents of the archive and generate a new one with the same contents; but I still have the exact same problem when trying to do the update.
    Does anyone know what is going wrong?
    I'm running the Sun JRE 1.4.1 on linux/i86.
    Thanks,
    Joe

    I'm having a related issue. Working on Red Hat Linux 8.0 I am unable to update the jar file with the new entry to the manifest. I run...
    jar -umf manifest Hello.jar
    and the output to the terminal is...
    jar: '-u' mode unimplemented.
    If anyone has thoughts about this or managed to resolve this error, please post. Thanks.

  • How to build a jar file so the program can access its resources folder?

    I have a java program written by someone else in which I have made a trivial change (I changed the background color). The jar file runs but it does not find one of the resources file.
    Here is the project folder's structure
    mainClass.txt (manifest text file)
    folder resources (includes file Java does not find: order.txt, a text file)
    folder CFPT ( includes .class files)
    folder cpl (includes .class files)
    folder results
    I tried
    jar cvmf mainClass.txt CFPT0.jar CFPT/*.class cpl/*.class resources results
    I get a lot of "adding: resources/..."
    including the one pertaining to the files which is later not found
    adding: resources/order.txt(in = 411) (out= 169)(deflated 58%)
    the code that chokes right now is the following,
    Object i = new Object();
    InputStream is = i.getClass().getResourceAsStream("/resources/" + resourceName);
    when I run java -jar CFPT0.jar the program runs
    but it soon gives an error, cannot find resourceName order.txt (is == null)
    I have Core Java Volume 1 page 498 but it does not help me figure out what I am doing wrong.
    Can somone help me build the jar file correctly so the program can find its resources?
    Is this a classpath issue? What do I need to do?

    My last mainClass.txt file content:
    Main-Class: CFPT.CFPTRunner
    Class-Path: ./resources ./results
    I also tried
    Class-Path: resources results
    Initially I only had the first line.
    I put back /resources in the java file as the / is necessary to indicate absolute path.
    Otherwise it looks relative to calling class.
    I tried adding the path on the second line of the manifest file per Wikipedia example
    http://en.wikipedia.org/wiki/Classpath
    I looked at
    http://java.sun.com/javase/6/docs/technotes/guides/lang/resources.html
    If you use the -sourcepath option, the compiler searches the indicated path for source files; otherwise the compiler searches the user class path both for class files and source files.
    http://java.sun.com/javase/6/docs/technotes/guides/lang/resources.html
    resources
    I took out the -d classes and compiled the .class files right with the java files in case that was the problem
    javac -classpath . CFPT/CFPTRunner.java
    jar cvmf mainClass.txt CFPT0.jar CFPT/*.class cpl/*.class resources results
    java -jar CFPT0.jar
    Still no go

  • Running a .jar from a C# program...

    I'm posting this question in a C# forum as well, but I thought I'd post it here as well because I suspect this might be a Java problem as much as it is a .NET / C# problem.
    I'm trying to run a .jar program via a C# program. I've created a C# program that will run and successfully call the .jar. That's the easy part. However, when the .jar is called, nothing happens. I created a .bat file that will run the .jar file so it will open a command prompt (so I can see what's happening). I changed my C# program to call the batch file. The batch file opens, executes, and gives me an error message. The error is: "Unable to access jarfile myProgram.jar"
    Any ideas on what my problem may be? Am I going about this completely the wrong way? Do I need to do something specific to allow the .jar to run?

    "Unable to access jarfile myProgram.jar"
    It seems obvious to me that you are assuming the
    batch script's current working directory is not what
    it really is.
    Add this to the script:
    cdto have it tell you what the current directory is,
    and that should clue you in.I'm not that familiar with batch scripting...I'm glad someone is!
    Here's what my .bat file looks like:
    @echo off
    echo Press enter to run the program
    pause
    java -jar myProgram.jar
    pauseWhere in here should I do the cd?
    EDIT: By the way, the .bat and the .jar are (and will always be) in the same folder.

  • Printer Utility Keeps Hanging - "Program Not Responding"

    I recently updated to 10.4.9 on my Macbook. While I thought everything went fine, I noticed when I can no longer open up the "Printer Utility." Upon a restart, it generally works, but after putting the computer to sleep, and upon the next launch of the Printer Utility, it simply hangs. Checking System monitor reveals that the program is not responding.
    Very vexing. Any ideas?

    I have definitely confirmed the problem occurs immediately after a sleep cycle is initiated (from the apple menu).
    I performed the following sequence, and the results are repeatable: (I am using OS 10.4.9. on a G5 iMac, 2GHx powerpc with 2 GB of SDRAM and a 400 Gig hard drive.)
    Boot the Mac.
    Open Photoshop to see that it opens a jpg (it does).
    Open Word and attempt to print an existing file (it will).
    Put the Mac to sleep from the apple menu.
    Wake the Mac and attempt to again print the same (open) Word document. Kernel Panic, spinning beachball, Word is no longer responding.
    In the past, a related symptom would be that Photoshop could locate but could not open a jpg that previously it could open; instead a kernel panic, photoshop no longer responding.
    I have done a hardware check, zapped the pram, used disk utility and diskwarrior. Everything is clean.
    The problem would happen rarely in the past, but as noted, it now happens after each sleep cycle (not sure if I have to manually put it to sleep, but will check this next). I believe it may be linked with 10.4.9 but am not sure.
    The only solution is a fresh reboot, and everything seems back to normal.
    Robin
    iMac G5 Mac OS X (10.4.2)

  • Creating a JAR File for a program that depends on other JAR files

    Hi, I'm pretty new to this so it shouldn't be terribly hard to answer:
    I have a program which uses JGoodies. There are 2 JGoodies .jar files in the same directory as my program. So I compile it by doing:
    javac -extdirs . NameOfMyProgram.java
    First off, is this the best way to do it? Is there any way of 'calling' these JAR files from within NameOfMyProgram.java?
    Secondly, if I then try to run it by doing java NameOfMyProgram, it doesn't work; can't find the JGoodies stuff. I end up having to add the classpaths of the unzipped JGoodies directories.
    So I have 2 questions:
    1. How can I execute my file so that it reads from the JAR files, not the big expanded folders that I unzipped?
    2. How can I create a JAR file that reads the JGoodies files properly? Right now, I have a Manifest.txt file that looks like:
    Main-Class: NameOfMyProgram
    Class-Path: forms-1.0.5.jar
    Class-Path: looks-1.3.1.jar
    Thanks a lot for your help!

    - learn how to use mysql JDBC
    - pack JDBC driver only
    - remotely access your DB
    - set proper security level for your app

  • Updating jar from a java program

    I have a text file in a jar. The contents of the file change during program execution and so, I need to be able to update the jar to reflect the changed contents. How do I do this from inside my program?
    Ravi

    There is no way to "update" a jar file. If you want to do that, you must create an entirely new jar file containing the modified data. So, you should only store permanent data in a jar file.

  • Associating executable Jar files w/ appropriate program

    Hi, I'm kinda new to java but this question is more OS related I think. I made a GUI program that reads / writes files and does some other stuff, I compiled it, then made it into an Executable JAR file. I put the file on my dektop w/ the required resource file (contains the read files) and then I double-click it and lo and behold Win-Ace(R) popps up. I right-clicked on the executable jar file, associated it with JAVAW, double-clicked again and it worked. So i guess my question is, is there a way that it will automatically associate itself with the right program so when I give this program to other people, they won't have to associate it the same way?
    Anyhelp would be greatly appriciated!

    No, becourse even if java could do that it would make sence becourse to run the jar it must be associated with javaw.
    But you could try to create a .reg file (registry file) that associate jar with javaw, when somebody runs the reg file it associate jar with javaw.
    But I think you should make different reg files for different windows versions (not sure about that).
    I don't have experience with how to write reg files but you just google.
    But I should try it out on your own windows, you could install windows on another partion and try it out on that one (first make a image with norton gost or something so if something goes wrong you can fastly get back to the old state).
    But you can also export your registry to a file so you can put the old registry back if somethings goes wrong.
    Use these tips on you own risk!!!

Maybe you are looking for

  • Cost budget report in local currency

    Hello all, I would like to use a statistical project to link maintenance costs to a budget that is maintained in PS. The functionality is all there. i'm now trying to find a proper report. Currently I'm doubting between 2 options: Option 1: CJ30: bud

  • Can I use a UAE Visa card on a US apple ID ?

    It's really bothering me that I can't really use much of the iTunes on the UAE store :(

  • Re: Running servlets automatically.

    this is the Continuation of my previous post Running servlets automatically. Hi everybody tnx for ur replies. I will explain my problem in detail here,so that somebody can suggest me an suitable solution. i need to update one table in DB for every si

  • A SIMPLE int[ ] array is driving me nuts!

    ok, what am I doing wrong? I've read many other posts saying the same thing: arrays giving null pointer exceptions, but I can't find an intelligible answer: * Demonstrates simple arrays public class DemonstrateSimpleArrays     private int[] anIntArra

  • My ipad will not sync with itunes/windows 8

    My ipad will not sync with windows 8. I had no problem with windows 7.