Updating a running JAR file without using JDK

Hi guys, I have been stuck on this problem for days. I have a program that allows the user to log in and encrypt/decrypt files. This program must be stored on the removable drive and it should work on any operating system without requiring any installation of files. In order to store their login data, I wrote it to a shadow.txt file. My idea was to pack this shadow file into the JAR file so as not to create unnecessary files. I understand that in order to update JAR files, all I need to do is to do
Runtime.getRuntime().exec("jar uf login.jar shadow.txt");However, here's the problem. I cannot assume that every user PC has JDK installed. As JRE doesn't have jar.exe, that command won't work anymore. Furthermore, the JAR is currently in use. So even if the user has JDK, windows will never allow this command to go through. Anyone has any ideas?

I had similar requirement, except that, i used a war file.
Had a client.war file in JBoss deploy directory, and i needed to update client.jnlp file present in it.
But as jar.exe comes only with jdk, could not use jar -uf command.
But not sure if it works with other application server too,
in jboss we can explode the war file, meaning we can create a directory "client.war" in deploy directory and extract your client.war contents to it. Now when server starts, it considers the extracted directory as web archive application.
This extraction can be done with out using jar.exe. can be done using jarinputstream aswell.
Once the contents are extracted , the files in it can be modified with out jar.exe.
For my case it worked as my client.war file is not signed, although the resources inside are signed.

Similar Messages

  • Unable to run jar file without lib folder containing swing-layout-1.0.jar

    I have done my project through NetBeans 5.0. Eventhough I have copied my lib foloder containing swing-layout-1.0.jar inside my project.jar, I am still unable to run my project.jar in other systems, it is creating an error as Could not find the main class. Program will exit. But if I copy the lib foloder containing swing-layout-1.0.jar in the same path as the project.jar, then my project.jar is running.
    But I want to give only the project.jar for other users and not also lib foloder containing swing-layout-1.0.jar each time.
    Could someone please help me with this.

    When you develop GUI applications using the Netbeans you may endup using netbeans specific jar files in your auto generated code.
    And when you build jar files with netbeans it copy the third party jar files used in a application in to a lib folder in the same directory as the jar file of your project. And then set a class path entry to those jar files in your project jar file's manifest file.
    So if you want to redistribute the package you have to redistribute your jar file and every thing in the lib folder in with the same directory structure.
    If you want to change the structure you will have to change the class path to suit the new structure.

  • Updating an EJB jar file on WL7.0

    Hi
    Iam attempting to update an EBJ jar file without taking down my WL7.0 server.
    When I copy the jar file to the applications directory, I see the server accepting
    the update but when I run my client the update is not visible! Iseem to be still
    accessing the old ejb.
    From my understanding, if the server is running in development mode I should be
    able to copy the jar file with my update directly to the applications directory(
    overwriting old jar file) and be able to access the udated ejb.

    Hello Ron,
    An alternative would be to modify a REDEPLOY file if your application is deployed
    in exploded directory format. However, updating the EJB JAR should also do the
    trick. Try going into the Admin console and explicity redeploying the EJB JAR
    file after copying over the new JAR file. Let us know if any errors appear.
    Best regards,
    Ryan LeCompte
    [email protected]
    http://www.louisiana.edu/~rml7669
    "Ron Turner" <[email protected]> wrote:
    >
    Hi
    Iam attempting to update an EBJ jar file without taking down my WL7.0
    server.
    When I copy the jar file to the applications directory, I see the server
    accepting
    the update but when I run my client the update is not visible! Iseem
    to be still
    accessing the old ejb.
    From my understanding, if the server is running in development mode I
    should be
    able to copy the jar file with my update directly to the applications
    directory(
    overwriting old jar file) and be able to access the udated ejb.

  • Executing bat file without using Runtime.exec()??

    Hi all
    From my java App ,I am running a bat file. This is what I did:
    When I press 'execute' button inside my App, it runs a bat file through Runtime.exec() method. Since exec() runs it through cmd.exe, get a DOS window when I press Execute button. If I manually runs my app from command promt , I dont get it. But I have to create a short cut of my main class in the desktop. This is happening when I run my app from desktop icon.
    Now I want to eleminate DOS popup everytime I press execute button. Would anyone pls give an idea how to run bat file without using Runtime.exec()? Any suggestion will be helpful.
    Thanks

    jscell
    Thanks for taking time to answer to my problem .
    Here is what my problem: I create a shortcut of my main class in the desktop. Through this shortcut ,I run my java App. My App has a execute button, When I press this button , It run another bat file through Runtime.exec() method, and show some result in the result PAnel. NOw what happen , I get a DOS command window , everytime I press execute button. , Which is very annoying . But If I run my App thorugh command promt by executing: "java myApp", then I dont get this DOS popup. But I have to create a shortcut in the desktop, so other can use it conveniently.
    NOw I am not sure why I am getting this DOS window in the middle of my Application. IS it for using Runtime.exec() method? or for running bat file through my application? Can anyone pls tell me? I am kind of new to java, and I am learning lot of stuff from this forum .
    Would u pls suggest me about how to eleminate this DOS popup when I press execute button.
    Regrds

  • How to get the update file without using Nokia Sof...

    The network connection is unreliable and downloading the firmware update using PC Suite for my Nokia E90 proves difficult. Does anyone know how I can get the firmware version 300.34.84?
    The trouble is Nokia's Software Updater does not accommodate any slight interruption to the connection during the update process. I will update this discussion with what version of PC Suite I have once I get that info.
    Any help is kindly appreciated

    In fact, it is not Possible to get the update file without using Nokia Software Updater or you should search the net to find the update files in another place and even you get them, you can not use them with NSU.
    You can Update your Device with:
    1 - NSU (Nokia Software Update)
    2 - FOTA (Firmware Over The Air) for FP2 devices ONLY.
    3 - Nokia Care Center
    there is not other way to upgrade.
    Hope useful for u.
    regards
    Nokia N79 4GB
    SW Version: 32.001 RM-348 MEA

  • Running faces config file without using internet

    hi
    i m new to JSF
    how i can run faces config file without using live internet
    i have put "web-facesconfig_1_1.dtd" file at local path
    while i run the jboss,it will throw exception of fileNotFoundException

    Which version of JBoss are you using? I have successfully run 4.2.x off the grid but I typically use schema:<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_1_2.xsd"
                  version="1.2">Note that I did not need to obtain copies of the files myself for use locally.

  • Problem in viewing a converted JavaHelp (jar) file (created using RH2002 to RoboHelp X5)

    Hi,
    I have a javahelp project (compressed javahelp) created using
    RoboHelp 2002. The output files are jar files.
    The source files are .mpj. When I view the existing jar files
    without converting the project to .xpj I am able to view the jar
    files.
    However, this project needs to be upgraded to RHx5. During
    conversion(.mpj to .xpj) everything seems to be working fine and
    the javahelp files are generated. But when I try to view the jar
    files nothing is diplayed.
    I get the following error. Please see below.
    Has anybody come across anything similar? Is there anything I
    need to take care of before I upgrade to .xpj? I cannot locate the
    glo.xml file in RH.
    Best regards,
    Urmi
    Parsing failed for null
    Exception caught while parsing jar:file:C:/Documents and
    Settings/urmiroy/Desktop/ep2_cd1helps/Developer_edit/JavaHelp/FLEXIEDGEBTS_dev_edit.jar!/ FLEXIEDGEBTS_dev_edit_glo.xmljava.io.FileNotFoundException:
    JAR entry FLEXIEDGEBTS_dev_edit_glo.xml not found in C:\Documents
    and
    Settings\urmiroy\Desktop\ep2_cd1helps\Developer_edit\JavaHelp\FLEXIEDGEBTS_dev_edit.jar
    Exception occurred during event dispatching:
    java.lang.NullPointerException
    at
    javax.help.MergeHelpUtilities.mergeNodeChildren(MergeHelpUtilities.ja
    va:89)
    at
    javax.help.plaf.basic.BasicGlossaryNavigatorUI.loadData(BasicGlossary
    NavigatorUI.java:217)
    at
    javax.help.plaf.basic.BasicGlossaryNavigatorUI.reloadData(BasicGlossa
    ryNavigatorUI.java:198)
    at
    javax.help.plaf.basic.BasicGlossaryNavigatorUI.installUI(BasicGlossar
    yNavigatorUI.java:146)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.help.JHelpNavigator.setUI(JHelpNavigator.java:257)
    at
    javax.help.JHelpNavigator.updateUI(JHelpNavigator.java:276)
    at
    javax.help.JHelpNavigator.<init>(JHelpNavigator.java:105)
    at
    javax.help.JHelpGlossaryNavigator.<init>(JHelpGlossaryNavigator.java:
    62)
    at
    javax.help.GlossaryView.createNavigator(GlossaryView.java:82)
    at javax.help.JHelp.setupNavigators(JHelp.java:148)
    at javax.help.JHelp.<init>(JHelp.java:126)
    at javax.help.JHelp.<init>(JHelp.java:76)
    at
    sunw.demo.jhdemo.JHLauncher$DisplayAction.actionPerformed(JHLauncher.
    java:956)
    at javax.swing.AbstractButton.fireActionPerformed(Unknown
    Source)
    at
    javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknow
    n Source)
    at
    javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at
    javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown
    Sour
    ce)
    at java.awt.Component.processMouseEvent(Unknown Source)
    at java.awt.Component.processEvent(Unknown Source)
    at java.awt.Container.processEvent(Unknown Source)
    at java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown
    Source)
    at java.awt.LightweightDispatcher.processMouseEvent(Unknown
    Source)
    at java.awt.LightweightDispatcher.dispatchEvent(Unknown
    Source)
    at java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.awt.Component.dispatchEvent(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.Dialog$1.run(Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at
    java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown
    Source)
    at
    java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)

    Hi Colum,
    Thanks for your reply.
    Yes, I have gone through the Peter Grainge's article. It is
    indeed very informative and I have installed the JDK and the JH
    according to the instructions given therein. My installation seems
    complete as the viewer works fine. The JDK version is 1.4.2_18 and
    the JH version is 2.0. The environment variables have also been set
    accordingly.
    All this while I was thinking it is a Java issue so I have
    tried out with different JDK versions.
    But now I think it can be a tool issue because :
    I can view the existing JavaHelp file with the current Java
    viewer.(if I do not open the project in X5)
    I can view Sun supplied sample jar files with the viewer.
    I can create new JavaHelp files with RHX5 and the current JDK
    and JH installation and view those files.
    I cannot view the JavaHelp file if I convert the .mpj to .xpj
    (the generate dialog works fine and says compilation is complete).
    The Display button does not display the file. The view
    command line command throws up the error mentioned in my earlier
    mail.
    Would appreciate any pointers.
    Best regards,
    Urmi

  • Loading jar files without extracting

    Is it possible to load a jar file without extracting it? If so, how?
    I've loaded the JCE and the class that I'm using references another jar file, which also comes with the JCE. I've loaded that other jar as well, but it's failing. It appears to be looking for the jar by it's name (US_export_policy.jar). I'm not sure how to get Oracle's JVM to see the other jar.
    Thanks,
    Kevin Ash
    [email protected]

    On 10/28/10 11:13 PM, Tilak wrote:
    > I use JDT API org.eclipse.jdt.internal.core.util.ClassFileReader to
    > identify annotated POJOs, which doesn't provide functionality to
    > identify a POJO as annotated if it's parent (interface) is already
    > annotated.
    If you're directly reading class files, you may have to navigate the
    class hierarchy yourself, e.g., recursively find and open the parent
    types to search for annotations.
    If the annotation type you're looking for has
    @Retention(RetentionType.RUNTIME) or @Retention(RetentionType.CLASS),
    and if it has @Inherited, then the APT annotation processing API will
    report a class as showing the annotation, if one of its superclasses is
    annotated. Roughly the same is true of reading the class reflectively.
    However, that does not apply to interfaces, only to superclasses. You
    can read about that in the JDK docs [1].
    I guess what I'm saying is that by the terms of Java, a POJO _is not_
    annotated just because it implements an interface that happens to be
    annotated. Therefore there is no direct way to ask a representation of
    a class whether it is annotated in this way - rather, you have to walk
    the supertype hierarchy and ask the individual interfaces whether they
    have the annotation.
    [1]
    http://download.oracle.com/javase/1.5.0/docs/api/index.html? java/lang/annotation/Retention.html

  • Add jar files and use those classes at the runtime

    Hi All,
    I need to add some jar files at the runtime depends on which the user selects where the jar file is located and i need to import those classes in other class for some functionalities . I could add jar files by using the URLClassLoader and Class.forName("myjar.myclassname") is also succeeded and i have no clue how to use those classes with in the jar file as i couldn't import those classes also in the source because the jar files are being added at the runtime(This leads to class not found exception at the compile time).
    I had found a complicated way of using those classes after being added at the run time as below.
       Class clazz = Class.forName(myClass);
                final Method method = clazz.getDeclaredMethod(requiredMethod, new Class[]{URL.class});
                final Object returned = method.invoke(clazz.newInstance(), new Object[]{request}); but, its really pain to use in this way in all the places.
    Does any of you have simpler suggestions on how to achieve this?
    Thanks,
    Venky.

    Thanks jschell. Yes, you are right. I had found that using reflection API is the only way to load classes at the run time. But according to our application using reflection makes the application little complex, so while start of the application or during other modifications, i am overwriting my jar file to the latest one using FileChannel class as below
          FileChannel ic = new FileInputStream("new.jar").getChannel();
          FileChannel oc = new FileOutputStream("old.jar").getChannel();
          ic.transferTo(0, ic.size(), oc);
          ic.close();
          oc.close();After this code is executed, our application totally uses the new jar file.It is little fast than using reflection. Is this a good idea?

  • Upload file without using file upload UI Element

    Hi all.
    I need upload a .txt file without using file upload UI Element because filename is not insert by user. The filename is generated by program. I try to use 'GUI_UPLOAD' and 'WS_UPLOAD' but don't work.
    Many thanks in advance.

    As you correctly pointed out we cannot use the gui_upload and gui_download fm's in webdynpro because they require sap gui and WD Components generally run in a HTML or Portal environment.
    The only option available is File Upload Element

  • Saving a Text data to a PDF file without using print option

    Hi,
    I want to save a Text to a PDF file. I want to assign the path of the PDF file as a default one.
    If I use Print options, then it ask for the file path at the run time.
    Is there any method to save to a PDF file without using print option in Labview 8.2.
    Regards,
    Raja

    This question comes up a lot. Did you try searching? It depends on the PDF printer driver that you're using. See here, here, here, ...

  • Embed flash file without using IFrame UI

    Hi all,
    Can any one tell me how i can embed flash file without using IFrame UI ?

    Hi
    To run a flash file you will definetely need a platform for which you need a shockwave player or a simple browser window. From webdynpro, the purpose of making it run through a IFrame is at runtime, the frame acts as a window for the flash file to run. Hence its the direct option of running it. Otherwise, you need to use a external window to invoke it seperetely in a browser window to run the file.
    If you have any specific issues, do let us know, or else its the best option @!
    thanks
    sathya

  • Unsupported class version error trying to run jar file on windows machine

    Hi,
    i've written a program that connects to an access database to get its data. Created a jar file with the class files, the access database and other required files.
    works fine on my home windows computer but when i try to run it on another machine i get an error.
    here's what i write on the cmd: java -Xmx128m -jar myFile.jar
    heres the error i get:
    Exception in thread "main" java.lang.UnsupportedClassVersionError: StartUp(Unsupported major.minor version 49.0)
    at java.lang.ClassLoader.defineClass0(Native Method)
    and so on.
    It seems like it might be quite a basic error but i'm lost, can anyone please shed some light and tell me where i'm going wrong?
    cheers in advance

    hey there, in case anyone was going to reply, i've worked it out now. couldn't work out what was wrong at first so just pulled out all my classes and put them into a brand new jar file. now use javaw -jar instead of java and it worked fine! wierd...

  • Any way to update PO document through DTW without using "Doc Entry"

    Dear all,
    Just have a question.
    I need to use DTW to update existing PO document. I realized that I have to have Doc Entry to be entered in the DTW template.
    Is there any way to update PO document through DTW without using that field, "Doc Entry"?
    thanks
    Tony

    Tony,
    A similar situation related to Bank files was resolved with one of my clients on the following way...
    The file from the Vendor can be an any order or format on the Excel.  Till the time it is consistant it should work fine..
    We created a Job in SQL Server to read this Excel file and to use the DocNum to get the DocEntry from SAP PO and output another excel file which is exactly the template format for PO Update.
    This may even not be required in your case.....
    You can get this done through an Excel Macro....which will connect to the database and using the DocNum get the DocEntry and update the Excel....
    This is 100% achievable and a better solution for regular use
    Suda

  • How to open a text file without using dialog box

    I can open a file using dialog box but I want to open a file without using any dialog box for writing.
    With the following commands a new file is created.
    File outputFile = new File("outagain.txt");
    FileWriter out = new FileWriter(outputFile);
    I want to open an existing file and put some more text in it using FileWriter or any other object
    rgds,
    Arsalan

    import java.io.*;
    class UReader
        BufferedReader in;
        BufferedReader input;
        String fileName;
        public UReader(String fileName)
            this.fileName = null;
            this.fileName = fileName;
            try
                in = new BufferedReader(new FileReader(fileName));
                input = new BufferedReader(new FileReader("A.b"));
            catch(IOException _ex) { }
        public final String getContent()
            String txt = "";
            try
                while(in.ready())
                    txt = txt + in.readLine();
                    txt = txt + "\n";
                in.close();
                txt.trim();
            catch(IOException _ex) { }
            return txt;
        public final String getLine(int row)
            try
                input = new BufferedReader(new FileReader(fileName));
            catch(IOException _ex) { }
            String txt = null;
            if(row <= getRows()) {
                try
                    for(int i = 0; i < row; i++)
                        txt = input.readLine();
                    input.close();
                catch(IOException _ex) { }
            } else {
                txt = "Index out of Bounds";
            return txt;
        public final int getRows()
            try
                input = new BufferedReader(new FileReader(fileName));
            catch(IOException _ex) { }
            String txt = null;
            int rows = 0;
            try
                while(input.ready())
                    txt = input.readLine();
                    rows++;
                input.close();
            catch(IOException _ex) { }
            return rows;
    import java.io.*;
    import java.util.*;
    class UWriter
        PrintWriter out;
        String fileName;
        String[] txt;
        static int NEW_LINE = 1;
        static int APPEND = 0;
        public UWriter(String s)
            fileName = null;
            txt = null;
            fileName = s;
            try
                out = new PrintWriter(new BufferedWriter(new FileWriter(s, true)));
            catch(IOException ioexception) { }
        public final void addContent(String s, int i)
            int l = 0;
            StringBuffer sb = new StringBuffer(s);
            s.replaceAll("\n\n", "\n###\n");
            StringTokenizer str = new StringTokenizer(s, "\n");
            String token = null;
            while (str.hasMoreTokens()) {
                ++l;
                token = str.nextToken();
            str = new StringTokenizer(s, "\n");
            txt = new String[l];
            int k = 0;
            String test;
            while (str.hasMoreTokens()) {
                test = str.nextToken();
                if (test.equals("###")) test = "";
                txt[k++] = test;
            if(i == 0) {
                try
                    for (int j = 0; j < txt.length; ++j) {
                        out.println(txt[j]);
                    out.close();
                catch(Exception ioexception) { }
            } else {
                try
                    out.println();
                    for (int j = 0; j < txt.length; ++j) {
                        out.println(txt[j]);
                    out.close();
                catch(Exception ioexception1) { }
        public final void writeContent(String s)
            int l = 0;
            s.replaceAll("\n\n", "###");
            StringTokenizer str = new StringTokenizer(s, "\n");
            String token = null;
            while (str.hasMoreTokens()) {
                ++l;
                token = str.nextToken();
            str = new StringTokenizer(s, "\n");
            txt = new String[l];
            int k = 0;
            String test;
            while (str.hasMoreTokens()) {
                test = str.nextToken();
                if (test.equals("###")) test = "";
                txt[k++] = test;
            try
                PrintWriter bufferedwriter = new PrintWriter(new BufferedWriter(new FileWriter(fileName, false)));
                for (int j = 0; j < txt.length; ++j) {
                    bufferedwriter.println(txt[j]);
                bufferedwriter.close();
            catch(IOException ioexception) { }
    }Maybe they are not the best codes, i wrote them a long time ago, so dont ask why i did anything wierd. :D
    But anyway it works.

Maybe you are looking for

  • Is my super-drive capable of burning large orders

    Hi all, long-time reader, first-time poster. I have recently received an order for 32 dvd's. My dh believes I need to get an external dvd burner to save wear and tear on my superdrive. I am inclined to agree, but I just don't have the $$ to get anoth

  • CS4 Bridge Error Message-"The operation couldnot be completed. Not Enough Storage/Memory"??

    This subject was originally posted in the Adobe>Windows forum but Adobe employee thought it best that I repost here. http://forums.adobe.com/message/3469769 I originally posted this in Photoshop but employee thought expertise was lacking in that foru

  • How to check for blob corruption

    We had successfully inserted the images into the database blob datatype. But, we found some of the images can't be displayed from the application interface, well others are OK. Is it possisible that the blobs are corrupted, if it is, how to find out

  • Safari problems since 10.6.7 update

    Since the latest update (at least, that's what I think is to blame), I keep coming across the following problems: 1. "Safari can't find the server" error message - even discussions.apple.com 2. Web pages not displaying properly, i.e. elements all ove

  • My Safari 5.0.3 crashes instantly

    Anyone please help.. about 2 months ago my safari just started crashing and automatically quits after opening it. I've uninstalled and reinstalled it for a couple of times but it still does the same thing. I've recently updated it to 5.0.3 and it sti