Run a Remote Jar file

How can I run a remote jar file?
There is a runnable jar (Java Application) file on server and my client program wants to run it on the client. What should I write for my client code to do this?
It is possible to load it directly into client memory and run it?
And basically, does a Jar file completely load into memory, when we are deploying it, or only required resources load?

I suppose you are not speaking of applets.
If Iunderstand your question correctly, you are looking for a way, the client always has newest software downloaded from the server.
If that is what you are looking for, try JavaWebStart.
You find tutorials on javasoft.com.
If you just want the client to download an application (like an .exe) use a runnable jar!

Similar Messages

  • How to run servlet inside jar file

    Hi
    I have a problem on running a servlet class which resides in a jar file.
    At first, it runs if it is located in the root directory of jar file, but if I put in inside a sub directory, I wasn't able to run it. It seems that the servlet class was not found.
    Here's the contents of my jar file:(eg. application.jar)
    META-INF/
    META-INF/MANIFEST.MF
    Business/
    Business/Business.class
    TransferManager/
    TransferManager/Default.class
    TransferManager/Application.class
    DAL/
    DAL/XMLDocument.class
    DAL/ParameterCollection.class
    DAL/ConnectionReaper.class
    DAL/JDCConnectionPool.class
    DAL/JDCConnection.class
    DAL/JDCConnectionDriver.class
    DAL/DataAccess.class
    Presentation/
    Presentation/IPresentation.class
    Presentation/XslTransform.class
    When I deploy this jar in tomcat4.0 and try to run the Default.class
    in the TransferManager package, the server can not locate the class.
    But if I put it in the root directory of the jar it works.
    Is there any additional setting in tomcat for this? Anyone can give
    me an idea for this?
    Thanks in advance...

    If you want to put the compiled servlet into Business/Business.class, you need for it to be in the Business package. I.e. the first line of code should be "package Business;" It looks like your jar file is in the right place, since Tomcat is finding something in it. So put your servlets in the appropriate packages and they should run. Also, you would have to change the configuration to refer to "Business.Business.class" and so on.

  • Error when running an executable jar file

    Hi
    I created a java application with a main method in one of the classes and through eclipse exported it as a jar file to run as a standalone application on another machine. In this application, I used a jar file sqljdbc.jar by referencing to it in the application. So I set the jar file's location in the classpath on the other machine and ran the application on the command prompt.
    java -jar myapplication.jar. But I get an error "java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver".
    I am not sure what else could be done. Thanks and appreciate any help on this.

    Do you mean you set the system Classpath on the other computer? When you use "java -jar" the only Classpath that is used is the Class-Path inside the jar's manifest.
    You need to either use the Class-Path in the manifest of myappication.jar to include the sql jar, or use "java -cp myapplication.jar;microsoftsql.jar TheMainClass" (use : instead of ; for *nix computers)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Error trying to run an executable Jar file

    Hi,
    I know a million people have asked this before. In the past 5 hours I have waded thru a dozen questions-answers-FAQs that were no help. So if anyone is willing to help a stupid person her is my problem:
    I developed a java program using the eclipse ide and it runs fine from within that ide.
    I packaged it into a Jar file, created a manifest file per the instructions.
    But when I double click on the jar file I get the following error from the Java Virtual Machine Loader;
    "Could not find main class. Program will exit."
    My Manifest file has the following text:
    Manifest-Version: 1.0
    Class-Path: swt.jar
    Main-Class: .graphicalUserInterface.AppStandAlone
    <blank line>
    the class AppStandAlone has the method "public static void main(String[] args) "
    it is in a package called "graphicalUserInterface".
    Any help anyone can give me would be greatly appreciated.

    Another 3 hours spent trying to run this java application in a Jar file.
    I identified that I did not have all class paths specified. So I tried to enter them in the "Class-Path:" line of the manifest file. But, according to the java tutorial, the syntax in a manifest file for classpaths is a space SEPARATING each path name. I have a space IN the path name and java is not understanding the paths correctly. For instance, I have a classpath c:\Progran Files\Java\etc... and java interprets this to be a classpath c:\Progran with Files\Java\etc as the program I want to run.
    I tried enclosing the paths in double quotes. Didn't work
    I tried enclosing the paths in single quotes. Didn't work
    I tried using a semicolon as a separator with double quotes. Didn't work
    I tried using a semicolon as a separator with single quotes. Didn't work
    I tried using a semicolon as a separator with no quotes. Didn't work
    I removed the "Class-Path:" line from the manifest and tried adding -cp param to the java command. Example:
    java -cp %classpath% -jar myapp.jar
    I tried all the variations above in the -cp param. None of them worked.
    The only thing that works is if I move executable jar file to the same directory as the required libraries. Then I specify a "Class-Path:" line with no spaces in the path names. Obviously this is not a permanent solution.
    If anyone else has the patience to help me I would really appreciate it.

  • How to Install Remote Jar File?

    Hi all
    I Would know how can I implement a application that download files and then i can run them.Specifically , I would like download a jar o jar file, and then install it.
    How can do it?
    I`ve thought in download by httpConection:
    HttpConnection c = (HttpConnection)Connector.open("http://localhost:80/cosa.txt");
    InputStream is = c.openInputStream();
    is.read()...
    ...Then I dont know what to do.I can save the stream in a file coding it in jar extension and then, try to run it in order to install it.
    But I dont know do any of those things.Could I do this?
    I have readed that it is easier to use of RMS, without save anything.But I ask myself how can i store the info so that i can install the jar o jad file.
    Any Idea?
    Thank you very much!

    Emunicio,
    Have a look at javax.microedition.midlet.MIDlet.platformRequest() method. Providing that you use URL pointing to a JAD file, and that your web server will send the right MIME types with JAD and JAR files, this call should trigger OTA installation.
    Daniel

  • Running application from jar file in a PDE project?

    I have a jar file with a simple application:
    import javax.swing.*;
    public class MyTest {
      public void test(){
        JOptionPane jp = new JOptionPane();
        jp.showInputDialog("Bob");
      public static void main(String[] args) {
        MyTest m = new MyTest();
        m.test();   
    }I have made the Hello World PDE Project in Eclipse on Vista. From the execute function I do:
          * the command has been executed, so extract extract the needed information
          * from the application context.
         public Object execute(ExecutionEvent event) throws ExecutionException {
    //          IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    //          MessageDialog.openInformation(window.getShell(), "MyPlugin", "Hello, Eclipse world");
           MyTest m = new MyTest();
           m.test();
              return null;
         }But nothing happens. I have added the external Jar file to the build path. Any ideas?

    I have tried running a debugger but I just get:
    "Source not found"
    when stepping over this line:
         MyTest m = new MyTest();
    I have not been able to find any pages on google that describes this problem or how to use external jars with a PDE project so any ideas are most welcome!

  • Run class in jar file using command prompt

    Hi,
    I have created a jar file OSTBTLDataTransfer.jar using eclipse and tried to run a class Person in the package com.aqa.details using the command prompt like this
    java -classpath com.aqa.details.Person
    but this complained about a jar file dependency and i have set it to the classpath like this:
    set CLASSPATH=C:\jarup\abc\ibatis-2.3.4.726.jar
    but it couldn't find the dependency when i tried to run again.
    please let me know your suggestions
    Thanks,
    KC

    java -classpath OSTBTLDataTransfer.jar com.aqa.details.Person
    or if you have an appropriate manifest in the jar simply
    java -jar OSTBTLDataTransfer.jar

  • Run EJBC on jar file (in Weblogic)

    Hi all,
    Why do we have to use the following statement while creating a jar file for Entity Beans deploying in Weblogic App server.
    ==================================
    java -classpath d:/bea/wlserver6.0/lib/weblogic_sp.jar;d:/bea/wlserver6.0/lib/weblogic.jar weblogic.ejbc -compiler javac build\std_ejb_trader.jar d:\ejb_trader.jar
    ===========================================
    Any help will be appreciated.
    Seetesh

    Hi Deepak,
    java -classpath d:/bea/wlserver6.0/lib/weblogic_sp.jar;d:/bea/wlserver6.0/lib/weblogic.jar weblogic.ejbc -compiler javac build\std_ejb_trader.jar d:\ejb_trader.jar
    The installer of Weblogic 6.0 is that it doesnt have this Weblogic_sp.jar while installing whereas Weblogic 6.1 has this jar file.
    Problem in this case using Weblogic 6.0 is that without Weblogic_sp.jar d:\ejb_trader.jar file doesnt get created at all.
    Thanks for ur reply,
    Seetesh

  • Could not run XML Explorer jar file

    Dear Java Experts,
    I need to debug some xhtml document but could not find a decent working free xhtml explorer around. The xmlassert-full.jar downloaded from http://sourceforge.net/projects/xpe/files%2Fxmlassert/
    could not be run with the following error:
    JAVA_HOME=C:\Program Files\Java\jdk1.7.0_03
    OS=Windows_NT
    Path=C:\Program Files\Java\jdk1.7.0_03\bin;...
    C:\>java -jar xmlassert-full.jar
    no main manifest attribute, in xmlassert-full.jarSimilarly, xpathexplorer0.1.3.zip from http://www.antepedia.com/detail/p/282834.html consisted of source code and require further instruction to
    compile it properly.
    I am running Java 7.x, Netbeans 7.2 on Windows XP / 7 platforms.
    Your advice on how to get either of these XHTML / XML explorer tools would be much appreciated.
    Thanks in advance,
    Jack

    Hi,
      Finding the jars for compilation is one issue that is time consuming... there are some tools which will help us find jars at ease.
      Jar class finder is one such a tool. 'Reference 1' tells you where to find the tool and 'Reference 2' tells you how to integrate with NWDS.
      reference 1: JAR Class Finder
      reference 2: Using JAR Class Finder
    Hope that helps.
    Regards,
    S.Divakar

  • How to run our own jar files on Nokia 3100

    Hi,
    I am new to J2me.
    I have written an J2me application using CLDC1.1
    and MIDP 2.0 it works well on emulator but
    when i tried to run it on device(Nokia 3100) it displays an error "Invalid File"
    please answer my question as soon as possible

    Look at this link http://www.j2mepolish.org/devices/Nokia/3100.html and check to see if you aren't using some API which is not supported by your Nokia 3100 phone, or if the jar size is to big, stuff like that.
    Also, use a Nokia emulator for the Series 40 to test and see if it works.
    Mihai

  • How to run my own jar file on nokia 6600?

    i am in urgent need of that. please let me know. i will be grateful to you.

    Look at this link http://www.j2mepolish.org/devices/Nokia/3100.html and check to see if you aren't using some API which is not supported by your Nokia 3100 phone, or if the jar size is to big, stuff like that.
    Also, use a Nokia emulator for the Series 40 to test and see if it works.
    Mihai

  • Running a jar file from java code

    Hi!
    Im trying to run a jar file from my code.
    I've tried Classloader, but that doesnt work because it doesnt find the images (also embedded in the 2nd jar file).
    WHat I would like to do is actually RUN the 2nd jar file from the first jar file. There must be a way to do this right?
    any ideas?

    ok, I found some wonderful code (see below) that will try to start the jar. But it doesn't. What it does is produce the following error when my application runs...
    So it's not finding the images in the jar file that I am trying to run? Strange. I checked the URL that sending, but it seems ok....
    I think I will check the url again to make sure......
    any ideas?
    Uncaught error fetching image:
    java.lang.NullPointerException
         at sun.awt.image.URLImageSource.getConnection(Unknown Source)
         at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
         at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
         at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
         at sun.awt.image.ImageFetcher.run(Unknown Source)
    the code....
    /* From http://java.sun.com/docs/books/tutorial/index.html */
    import java.io.IOException;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.lang.reflect.Modifier;
    import java.net.JarURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    import java.util.jar.Attributes;
    * Runs a jar application from any url. Usage is 'java JarRunner url [args..]'
    * where url is the url of the jar file and args is optional arguments to be
    * passed to the application's main method.
    public class JarRunner {
      public static void main(String[] args) {
        URL url = null;
        try {
          url = new URL(args[0]);//"VideoTagger.jar");
        } catch (MalformedURLException e) {
          System.out.println("Invalid URL: ");
        // Create the class loader for the application jar file
        JarClassLoader cl = new JarClassLoader(url);
        // Get the application's main class name
        String name = null;
        try {
          name = cl.getMainClassName();
        } catch (IOException e) {
          System.err.println("I/O error while loading JAR file:");
          e.printStackTrace();
          System.exit(1);
        if (name == null) {
          fatal("Specified jar file does not contain a 'Main-Class'"
              + " manifest attribute");
        // Get arguments for the application
        String[] newArgs = new String[args.length - 1];
        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
        // Invoke application's main class
        try {
          cl.invokeClass(name, newArgs);
        } catch (ClassNotFoundException e) {
          fatal("Class not found: " + name);
        } catch (NoSuchMethodException e) {
          fatal("Class does not define a 'main' method: " + name);
        } catch (InvocationTargetException e) {
          e.getTargetException().printStackTrace();
          System.exit(1);
      private static void fatal(String s) {
        System.err.println(s);
        System.exit(1);
    * A class loader for loading jar files, both local and remote.
    class JarClassLoader extends URLClassLoader {
      private URL url;
       * Creates a new JarClassLoader for the specified url.
       * @param url
       *            the url of the jar file
      public JarClassLoader(URL url) {
        super(new URL[] { url });
        this.url = url;
       * Returns the name of the jar file main class, or null if no "Main-Class"
       * manifest attributes was defined.
      public String getMainClassName() throws IOException {
        URL u = new URL("jar", "", url + "!/");
        JarURLConnection uc = (JarURLConnection) u.openConnection();
        Attributes attr = uc.getMainAttributes();
        return attr != null ? attr.getValue(Attributes.Name.MAIN_CLASS) : null;
       * Invokes the application in this jar file given the name of the main class
       * and an array of arguments. The class must define a static method "main"
       * which takes an array of String arguemtns and is of return type "void".
       * @param name
       *            the name of the main class
       * @param args
       *            the arguments for the application
       * @exception ClassNotFoundException
       *                if the specified class could not be found
       * @exception NoSuchMethodException
       *                if the specified class does not contain a "main" method
       * @exception InvocationTargetException
       *                if the application raised an exception
      public void invokeClass(String name, String[] args)
          throws ClassNotFoundException, NoSuchMethodException,
          InvocationTargetException {
        Class c = loadClass(name);
        Method m = c.getMethod("main", new Class[] { args.getClass() });
        m.setAccessible(true);
        int mods = m.getModifiers();
        if (m.getReturnType() != void.class || !Modifier.isStatic(mods)
            || !Modifier.isPublic(mods)) {
          throw new NoSuchMethodException("main");
        try {
          m.invoke(null, new Object[] { args });
        } catch (IllegalAccessException e) {
          // This should not happen, as we have disabled access checks
    }

  • How to load jar files from remote location

    Hi all,
    I am trying to load jar files from remote server, from a servlet which is running on OC4j.
    For doing this,First I am getting ClassLoader by using ClassLoader.getSystemClassLoader() and then type casting it to URLClassLoader.
    But by doing it I am getting ClassCastException,because oc4j returns oracle.classloader.PolicyClassLoader instead of java.net.ClassLoader.
    Appreciate if anyone can tell me how to load remote jar files using oracle.classloader.PolicyClassLoader .
    Thanks
    Harish

    Hi,
    I suppose you know about this, but just in case.
    I have used jnpl to load jar files from remote location.
    Rowan

  • Getting error when running the jar file..

    Hi All,
    I am new to executing jar file..Actually i have one class which contains the following code.
    import com.documentum.fc.client.DfClient;
    import com.documentum.fc.client.IDfClient;
    import com.documentum.fc.client.IDfSession;
    import com.documentum.fc.client.IDfSessionManager;
    import com.documentum.fc.common.DfLoginInfo;
    import com.documentum.fc.common.IDfLoginInfo;
    import com.documentum.fc.common.DfException;
    import com.fidelity.ftg.ereviewg2.migration.util.MigrationResource;
    * This class is used for creating docbase connection
    * *@type* DocbaseConnection
    * *@author* a405304
    * *@see*
    public *class *DocbaseConnection {
    //public static ResourceBundle resource;
    IDfSessionManager sMgr = *null*;
    IDfSession session = *null*;
    String docbaseName;
    *private* *static* DocbaseConnection +docbaseCon+;
    * Constructor for DocbaseConnection
    * *@throws* DfException
    * *@throws* Exception
    *private* DocbaseConnection()*throws* DfException, Exception{
    //ResourceBundle bundle = ResourceBundle.getBundle(Constants.RESOURCE_PATH,Locale.getDefault());
    MigrationResource bundle = MigrationResource.+getBundle+();
    String userId = bundle.getString("DOCBASE_USERID");
    String password = bundle.getString("DOCBASE_PASSWORD");
    docbaseName = bundle.getString("DOCBASE_NAME");
    IDfClient client = DfClient.+getLocalClient+();
    sMgr = client.newSessionManager();
    IDfLoginInfo loginInfo = *new* DfLoginInfo();
    loginInfo.setUser( userId );
    loginInfo.setPassword( password );
    loginInfo.setDomain("");
    sMgr.setIdentity( docbaseName, loginInfo );
    session= sMgr.getSession( docbaseName );
    System.+out+.println("# Connected to Docbase: "+session);
    }Now i create the jar file whose name is docbaseconnection.jar
    Now when i am running this jar file by using the following command then i am getting the following error..
    C:\JAR_FILES>java -jar docbaseconnection.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: com/documentum/fc/client/DfQuery
    For running this docbaseconnection.jar file i need the following thing in classpath...
    C:\Program Files\Documentum\dctm.jar;C:\Program Files\Documentum\Shared\dfc.jar;C:\Program Files\Documentum\Shared\log4j.jar
    I already add this jar files in the classpath of environment variables..Then also i am getting the same error..
    Kindly help me...........

    Well, let´s supose your manifest is defined as I did in my previous post. So, your directory base should be something like:
    C:\dir
    docbaseconnection.jar
    dctm.jar
    dfc.jar
    anotherlibraries.jar
    But, let´s supose you want something like
    C:\dir
    docbaseconnection.jar
    lib (folder, which contains dctm.jar, dfc.jar, etc)
    Then you should change the class-path of your manifest to
    Class-Path: ./lib/dctm.jar ./lib/dfc.jar
    That´s what I meant

  • Html script to run a Jar file

    Is it possible to automatically run a .jar file from an .html page? Here is my issue:
    I have a software script for athletes that runs from a jar file. I need to create an index.htm file in order to use the compiler software that I am using.
    So I am trying to figure out if there is a script to put in the index file that will immediately run the main .jar file. I don't want the viewer (athlete) to even see the index file so the only code I will put in there will be to run the .jar file.
    Is this possible?
    thank you!

    This all sounds very confused.
    There are applets (Java applications embedded in a webpages).
    There are stand alone applications (Java applications that are by themselves no web page required)
    There are servlets ( Java applications that produce HTML pages [and other web content])
    This bit about my compiler needs it makes no sense. And I don't know which of the above you have or are trying to be honest. I will tell you this, it is one of them (probably the first two).
    So which one of those are you trying to make? If you say none of them then please think harder because that is not a valid answer.

Maybe you are looking for

  • Can CAS array include server in DR site

    Hi, there: Our current Exchange 2010 environment: 1): Two HUB/CAS Exchange 2010 server running on Windows 2008 R2 use NLB to form a CAS array. 2): Two Exchange 2010 Mailbox server with one DAG. Please note all of these Exchange 2010 servers are on ou

  • Number of pics in album doesn't show in iTunes

    When I sync iPad with iTunes, how do I insure that iTunes shows the number of pictures in each album I check for import? It does sometimes, and sometimes not. Flakey.

  • Why is FCP_LOGIN displaying in log file

    We have a shell script that is registered and runs successfully in a dev environment. When we push this to a new environment we get the following values that display on the log file. FCP_REQID FCP_LOGIN FCP_USERID FCP_USERNAME FCP_PRINTER FCP_SAVE_OU

  • Resolve your issue and unlink your Skype and Micro...

    resolve your issue and unlink your Skype and Microsoft fast please limit on how many times

  • HT1331 cant see disks in the airport extreme setup

    cant see disks in the airport extreme "partions" to set up, tried different disks, cables, restart, etc, bottom line the extreme does not see any attached external hard drives, any ideas? Cheers Michael