Jar file with JRE and lib's

I'd like to create a jar file that also contains the JRE that I want to use as well as some libraries I'm using. Is that possible?
I have created in the past a batch file that points to an specific JRE that I package with my classes in a directory. But this time I'd like to package it in the jar file as well.
Thanks!

I'd like to create a jar file that also contains the
JRE that I want to use as well as some libraries I'm
using. Is that possible?Not and run that JRE. You have to extract it from the jar and put it in a directory. On Windows, this will allow you to run only Java applications from the commandline (not applets or anything associated with a browser).
I have created in the past a batch file that points
to an specific JRE that I package with my classes in
a directory. But this time I'd like to package it in
the jar file as well.
Thanks!

Similar Messages

  • How do you create a jar file with txt and classes?

    Hey, I'm trying to create code to create a jar file with a text file, but I can't figure out how to add the text file. Here is what I have so far:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
            }It creates the .jar file with the correct manifest but I can't get it to write the test.txt or anything else into the jar file.
    -Gandolf
    Edited by: GanMatt on Jun 18, 2009 8:18 AM
    Edited by: GanMatt on Jun 18, 2009 8:19 AM

    Alright, my question has changed. Here's the code:
    try {
                // Name of jar file to write
                String archiveFile = "test.jar";
                Manifest jman = new Manifest();
                try {
                    // Create a manifest from a file
                    //InputStream fis = new FileInputStream("manifestfile");
                    //Manifest manifest = new Manifest(fis);
                    // Construct a string version of a manifest
                    StringBuffer sbuf = new StringBuffer();
                    sbuf.append("Manifest-Version: 1.0\n");
                    sbuf.append("Ant-Version: Apache Ant 1.7.1\n");
                    sbuf.append("Created-By: 1.5.0_19-137 (Apple Inc.)\n");
                    sbuf.append("Main-Class: Main\n");
                    sbuf.append("Class-Path: lib/swing-layout-1.0.3.jar\n");
                    sbuf.append("X-COMMENT: Main-Class will be added automatically by build\n");
                    // Convert the string to a input stream
                    InputStream is = new ByteArrayInputStream(sbuf.toString().getBytes("UTF-8"));
                    // Create the manifest
                    jman = new Manifest(is);
                } catch (IOException e) {
                FileOutputStream stream = new FileOutputStream(archiveFile, true);// archive file is jar file name
                JarOutputStream out = new JarOutputStream(stream, jman);
                out.putNextEntry(new JarEntry("test.txt"));
                out.write("Hi".getBytes());
                out.flush();
                out.closeEntry();
                out.close();
            } catch (Exception ex) {
                JOptionPane.showMessageDialog(this,ex.toString(),"BUG!",JOptionPane.INFORMATION_MESSAGE);
            }It creates the jar file with the txt file inside it, but I can't write "Hi" inside of the text file. Any ideas?
    -Gandolf

  • Installing a JAR file with NAL

    This is in reference to my previous message about trying to use NAL to get
    to a URL with System Rights...
    In addition to having to install Java to use our new webpage, there is a jar
    file that has to get pushed out, too.
    It's not available as an executable, but, is there anyway to push out a jar
    file with NAL? Does it need to be run, or, just copied somewhere, and, if
    so...where?
    Thanks!

    We have an AGFA Imaging system that puts digitized x-rays, CAT-scans, etc.,
    up on a webserver, so that docs all over our hospital can pull them up and
    look at them.
    The previous system HAD to use the MSJVM, but, last Saturday they upgraded
    the system (not really telling us the requirements ahead of time...<G>), and
    it had to use the Sun JRE. Sooo....I had to setup an AppObj last Sunday to
    push out Java to all workstations, so went to Java.com and downloaded the
    latest version, 1.5.x
    Well...of course they had to use a certain version, 1.4.1_01, and, it
    wouldn't work with 1.5.x at all, so, I pushed that out, then it turned out
    that they use a product from Germany (AGFA, you know) named JacoZoom, and a
    jar file is asked to be run by the users when they first login to the
    website, and, of course...you have to be an Administrator.
    Our VA Security Managers like to over-protect us, so, the German site
    hosting JacoZoom is blocked, and, rather than drive home and download what I
    needed, I thought it would be easier just to push out the URL with System
    Rights temporarily (you understand that by this time, Monday afternoon, all
    our 400 doctors were up in arms because they couldn't view any images), and
    then the trying to push the URL just didn't work.
    Sooo...I drove home and got the JacoZoom product (had to buy it), which is a
    large executable containing several JAR files when exploded, one of which
    was the one that was being pushed out. Running the executable didn't do the
    trick (not sure why), and the JAR wouldn't run, even manually, but, I
    FINALLY found an email from another tech going through the same hassle, and,
    all he did was push a different JAR file to the \lib\ext folder in the JRE
    1.4.1_01 folder...and it worked.
    I did that, and, it worked, and deployed it all over the building.
    Welcome to my world--and, I'm not complaining, because with SMS (which we
    have to run, but don't use), I'd still be configuring the deployment
    package.
    Thanks.
    "Anders Gustafsson" <[email protected]> wrote in message
    news:[email protected]...
    > Bill Bradley,
    >> I pushed it to all sorts of locations, without luck. Do you have to RUN
    >> Jar
    >> files, somehow?
    >
    > It depends on what it is. A jar file is just a PKZIP file with java
    > classes. Is
    > this part of a greater something?
    >
    > - Anders Gustafsson, Engineer, CNE6, ASE
    > NSC Volunteer Sysop
    > Pedago, The Aaland Islands (N60 E20)
    >
    > Novell does not monitor these forums officially.
    > Enhancement requests for all Novell products may be made at
    > http://support.novell.com/enhancement
    >
    > Using VA 5.51 build 315 on Windows 2000 build 2195
    >

  • Re: Recognizing JAR files in WEB-INF/lib

    Steven Vetzal wrote:
    I am attempting to open existing web projects in NitroX and am beingplagued with:
    The class "com.someone.Class" is not in the application class path
    The classes are contained in JAR files in WEB-INF/lib.
    I have been looking for a way to add these JAR files to the classpath.
    There is no builder registered, so I'm not sure I can even get there
    from here :)
    Don't you love it when people answer their own questions?
    Here's what I did:
    Add the following sections to the .project file-
    Under BuildSpec:
    <buildCommand>
    <name>org.eclipse.jdt.core.javabuilder</name>
    <arguments>
    </arguments>
    </buildCommand>
    Under natures:
    <nature>org.eclipse.jdt.core.javanature</nature>
    <nature>com.m7.nitrox.webProjectNature</nature>
    This fixed up all my classpath issues - after I modified the Java
    classpath of course... For example, my .classpath file looks like:
    <classpathentry kind="src" path="WEB-INF/classes"/>
    <classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/>
    <classpathentry kind="con" path="J2ee.runtime.m7"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/>
    <classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/>
    <classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/>
    <classpathentry kind="output" path="WEB-INF/classes"/>
    I found that by examining these files from other projects (like from the
    web project wizard) it was easy to find out what my broken project was
    missing.
    Hopefully this will help someone else one day :)
    Steve

    Hi Steven,
    Sorry for the late response, next time you can do this in a more simple way
    by launching Properties window (right click on project) and select Java
    Build Path, click on Libraries tab.
    Thanks
    M7 Support
    "Steven Vetzal" <[email protected]> wrote in message
    news:[email protected]..
    Steven Vetzal wrote:I am attempting to open existing web projects in NitroX and am being
    plagued with:
    The class "com.someone.Class" is not in the application class path
    The classes are contained in JAR files in WEB-INF/lib.
    I have been looking for a way to add these JAR files to the classpath.
    There is no builder registered, so I'm not sure I can even get there from
    here :)
    Don't you love it when people answer their own questions?
    Here's what I did:
    Add the following sections to the .project file-
    Under BuildSpec:
    buildCommand
    name>org.eclipse.jdt.core.javabuilder</name
    arguments
    /arguments
    /buildCommand
    Under natures:
    nature>org.eclipse.jdt.core.javanature</nature
    nature>com.m7.nitrox.webProjectNature</nature
    This fixed up all my classpath issues - after I modified the Java
    classpath of course... For example, my .classpath file looks like:
    classpathentry kind="src" path="WEB-INF/classes"/
    classpathentry kind="lib" path="WEB-INF/lib/cms-bindings-3.0.2.jar"/
    classpathentry kind="con" path="J2ee.runtime.m7"/
    classpathentry kind="con"
    path="org.eclipse.jdt.launching.JRE_CONTAINER"/
    classpathentry kind="lib" path="WEB-INF/lib/cms-ejb-2.4.0.jar"/
    classpathentry kind="lib" path="WEB-INF/lib/jstl.jar"/
    classpathentry kind="lib" path="WEB-INF/lib/standard.jar"/
    classpathentry kind="output" path="WEB-INF/classes"/
    I found that by examining these files from other projects (like from the
    web project wizard) it was easy to find out what my broken project was
    missing.
    Hopefully this will help someone else one day :)
    Steve

  • Updated JAR files in j2ee/home/lib

    We are developing and deploying j2ee applications to a 9.0.2.3 9iAS server. We have a framework.jar file that we have a number of applications in two OC4J instances (home and portal) that need to use this jar file. As a result, we place the jar file in the j2ee/home/lib directory since this could be seen by all applications. My question comes in when we try and update this jar file. We seem to experience problems when moving a new framework.jar file into the directory. We mainly notice this issue in our EM Website. We begin to get the following error in the EM Website after we move an updated jar file into the directory:
    Servlet error: Renderer failed: java.lang.InternalError: jzentry == 0
    I've seen this error before and it seems to link back to a problem with jar files. If I remove the new jar file the error disappears. We are eventually able to get the jar file in, but only after restarting the whole mid-tier. Is this normal? Should we have to restart the server everytime we update the jar file? If so, what would be the best way to implement the new jar files? Stop mid-tier, move new file in and restart??
    Would you recommend a different location for this jar file?? Our biggest concern is that we only want to deploy this jar file one time and have all applications that need it find it. Thanks in advance for any input you might have.
    Beth

    Libraries loaded from the j2ee/home/lib directory are opened and loaded at the J2EE container level. So they are accessed from the very start of the server, to the point where it is stopped.
    Therefore if you modify a class library which has already been loaded, you may run into file locking related issues (which will be OS dependent, Windows for example probably won't even let you overwrite the file) so that is what you are likely to be seeing.
    JAR files loaded at the J2EE container level aren't really suitable for dynamic updating -- the classes can be referenced in a multitude of other classloaders.
    As you have seen, replacing a J2EE container level class file, then a restart will be required along the lines of what you have written.
    Stop mid-tier, move new file in and restart?? cheers
    -steve-

  • How to run jar files with arguments?

    Hi everybody,
    Is it possible to run a jar file with arguments passed to its MAIN class?
    If yes can you help me on how to do it?
    Thanx

    I am in complete agreement with FahleE. I'll refine it a bit.
    On my machine (running RedHatLinux8.0) you can run the demos like this.
    1. open a console window
    2. go to the directory where the demo you wish to run, say, demo.jar, is located
    for instance for the SwingSet2-demo
    cd /usr/lib/java/demo/jfc/SwingSet2
    3. run the jar file
    java -jar demo.jar
    In order to run it windows style, ie, launching by double clicking, save these lines in a file called
    LaunchJar.sh
    cd /usr/lib/java/demo/jfc/SwingSet2
    java -jar demo.jar
    where demo.jar is the jar file you want to run.
    Right click on the LaunchJar.sh and go to the 'Properties' tab. Check the 'Execute' permissions for Owner/groups/others. You can also do the same thing by chmod command.
    Now double-click on the LaunchJar.sh file: your application should be launched.
    Palash.
    Please Note: It is important to set the path variable to your JAVA_HOME directory....
    Otherwise, instead of
    java -jar demo.jar, you will need to use the full path to your JAVA_HOME/bin directory like:
    JAVA_HOME/bin /java -jar demo.jar.
    Where JAVA_HOME is the directory where you have installed java. Typically it is usr/java or usr/local/java

  • Exporting a jar file with its libraries

    Hi there,
    I have problem while exporting jar files with Eclipse.My program uses db2driver libraries and i want to make stay these library files while exporting the main program but there is no choice to make it like that. And when i execute my program jar file it throws a class not found exception for db2drivers ...
    How can i pack the jar files with my program jar?
    Thanks for help.

    Hi Peter,
    I made the changes but still got the problem...
    here is my .classpath file:
    <?xml version="1.0" encoding="UTF-8"?>
    <classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry exported="true" kind="lib" path="db2jcc_license_cu.jar"/>
    <classpathentry exported="true" kind="lib" path="db2jcc.jar"/>
    <classpathentry kind="output" path="bin"/>
    </classpath>
    when i execute my jar file it throws a ClassNotFoundExeption for DB2Drivers which are in db2jcc.jar ...(my startng class is at src package)
    Thanks..

  • How can I get a single jar file with NetBeans?

    How can I get a single jar file with NetBeans?
    When I create the project I get these files:
    dist/lib/libreria1.jar
    dist/lib/libreria2.jar
    dist/software.jar
    The libraries that have been imported to create the project are in separate folders:
    libreria1/libreria1.jar
    libreria2/libreria2.jar
    libreria1, libreria2, dist folders are all located inside the project folder.
    I added the following code to the build.xml:
    <target name="-post-jar">
    <jar jarfile="dist/software.jar">
    <zipfileset src="${dist.jar}" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria1.jar" excludes="META-INF/*" />
    <zipfileset src="dist/lib/libreria2.jar" excludes="META-INF/*" />
    <manifest>
    <attribute name="Main-Class" value="pacco.classeprincipale"/>
    </manifest>
    </jar>
    </target>
    Of course there is also the project folder:
    src/pacco/classeprincipale.form
    src/pacco/classeprincipale.java
    Can you tell me what is wrong? The error message I get is as follows:
    C:...\build.xml:75: Problem creating jar: archive is not a ZIP archive BUILD FAILED (total time: 2 seconds)

    This is not a NetBeans forum, it is a JDeveloper forum. You might want to try http://forums.netbeans.org/. I also saw your other question - try looking in the New to Java forum: New To Java

  • ServiceBus java callout - how to pack the JAR file with libraries?

    Hello
    I want to use a Java Callout from a Service Bus flow.
    What is the correct way to pack the JAR file with its nessecary libraries?
    I tried different methods to pack my JAR, but yet, as though the Java runs perfectly from the Workshop (Eclipse) , when I am trying to use the exported Jar on the ServiceBus flow, it fails with an ClassNotFoundException.
    I would really appreciate your advice here.
    Thanks
    Koby

    Well.. Looking inside my exported JAR file, I got all of the files there inside, including the jar file containing the library.
    What I'm trying to do is run a simple java program that connect through SSH and therefore use an SSH library.
    On the workshop I got it as an imported library JAR. And it works perfectly there.
    Any idea?
    Here's the complete error I get:
    <BEA-382515> <Callout to java method "public static java.lang.String sshpackage.SshProg.remoteScriptInvoke(java.lang.String,java.lang.String,java.lang.String,java.lang.String)" resulted in exception: null
    java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at stages.transform.runtime.JavaCalloutRuntimeStep$1.run(JavaCalloutRuntimeStep.java:158)
    Truncated. see log file for complete stacktrace
    java.lang.NoClassDefFoundError: ch/ethz/ssh2/Connection
    at sshpackage.SshProg.remoteScriptInvoke(SshProg.java:29)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    Truncated. see log file for complete stacktrace
    java.lang.ClassNotFoundException: ch.ethz.ssh2.Connection
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:283)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:256)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at com.bea.wli.sb.resources.archive.HookedJarClassLoader.loadClass(HookedJarClassLoader.java:251)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
    Truncated. see log file for complete stacktrace
    Edited by: kobyssh on 04:12 01/02/2010

  • Packaging  jar  file with classes

    Hi experts,
    I want to clarify a problem in relation with packaging .class files in jar file making
    it jar executable.I was able to achieve this when number of classes are limited and confined to only a single program.However recently i developed a software
    which is very much like SQL*Plus and retriee my company database using screen buffer management and i have handled almost all the issues.
    But so long to execute this program i am typing
    java <Program name>.It is using Oracle as backend.
    I tried to package Oracle driver files in jar using
    jar -cmf manifest.mf sqlpad.jar *.class Oracle\
    where Oracle directory contains all the class files in separate folders like
    Oracle\javax etc
    I get a jar file with hefty MBs size.It is executable too.But when i try to connect to
    database, i get message Oracle driver class is not found.
    In what way should i package it as jar file ?

    I wouldn't add the drivers to the JAR itself. Instead, I'd suggest one of the following:
    1.) Add classpath entries into your manifest file pointing to the drivers' JARs
    2.) Create a batch file for starting that contains a call to "java -classpath ..."
    3.) Add some way to your app to configure additional classpaths at runtime and use a URLClasssLoader (and a wrapper class for the driver for registering with the DriverManager) that loads the driver's class

  • Partial redeployment of a static jar file with weblogic.Deployer

    Hello,
    We are working on an application serving jar files to customers, via Java Web Start, hence that are considered from our point of view as static files, like our HTML and Javascript pages.
    Moreover, we have one jar that changes regularly, so every time it's loaded on the server we need to do a partial redeployment of this jar file, as documented here: http://docs.oracle.com/cd/E13222_01/wls/docs103/deployment/redeploy.html#wp1025739
    However, it does not work, as I believe WebLogic doesn't consider my jar file as a static file.
    C:\>java -cp weblogic.jar weblogic.Deployer -adminurl http://mymachine:7001 -user weblogic -password mystrongpassword -name myapp -redeploy launcher/downloadme.jar
    weblogic.Deployer invoked with options: -adminurl http://mymachine:7001 -user weblogic -name myapp -redeploy launcher/downloadme.jar
    <Mar 8, 2013 7:09:36 PM CET> <Info> <J2EE Deployment SPI> <BEA-260121> <Initiating redeploy operation for application, myapp [archive: null], to configured targets.>
    Task 24 initiated: [Deployer:149026]redeploy application myapp [Version=7] on WebServer.
    Task 24 failed: [Deployer:149026]redeploy application myapp [Version=7] on WebServer.
    Target state: redeploy failed on Server WebServer
    weblogic.management.DeploymentException:
    The application myapp#7 cannot have the resource launcher/downloadme.jar updated dynamically. Either:
    1.) The resource does not exist.
    or
    2) The resource cannot be changed dynamically.
    Please ensure the resource uri is correct, and redeploy the entire application for this change to take effect.
    As a side note, if I rename downloadme.jar to downloadme.jar.*html*, then WebLogic agrees to redeploy it!
    Is there any way to force the static redeployment of my jar file?
    Thanks and regards,
    Julien

    Hi,
    The feature you are trying to use works only when web application is deployed in exploded format. Is your app deployed in exploded format?
    Also jars are never considered static, so I doubt this will work here.
    As an alternative you can go for Oracle Weblogic Production redployment feature. Refer to - http://middlewaresupport.wordpress.com/2013/03/21/production-redeployment-feature-in-weblogic/
    Thanks,
    Ranjan
    Edited by: Ranjan K on Apr 12, 2013 5:45 AM

  • Update jar file with modified class files

    hi all,
    I'm developing a jar utility for updating a jar file with modified class files as of now i have reached a point where in i can browse files and set it to required location
    i.e i have developed a swings GUI application using JfileChooser and browse the files ..now my requirement is to update the jar files with modified class file
    GUI looks like below
    ....enter the modified class file ----> d:\c.class
    ....enter the jar file path ---> d:\a.jar
                                                          update button now i have the requirement as
    1> when i click on the update button ,my jar file (a.jar) should get updated with the latest class file (c.class)
    can u help me to achieve this requirement.???
    im stuck with this,,,if u can provide me wit the code for updating jar file with latest class file...it will really be helpful
    if u can help me with the code on click on update button it will be really helpful
    Thanks and expecting a faster response from u all java experts....

    Please find my query in bolds...i have written the partial code now,i need some help now
    hope u guys can help me out...
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.File;
    public class FileExplorer extends JDialog implements ActionListener
         JTextField txtLocation_class;
         JButton btnBrowse_class;
         JLabel label_class;
         JTextField txtLocation_jar;
         JButton btnBrowse_jar;
         JLabel label_jar;
         JButton updatebutton;
         public FileExplorer()
                   setSize(600,300);
                   //for class files
                   label_class = new JLabel("Please select Modified Class File");
                   txtLocation_class= new JTextField(20);
                   btnBrowse_class = new JButton("Browse");
                   btnBrowse_class.addActionListener(this);
                   //for jar files               
                   label_jar = new JLabel(" Please select the Jar file");
                   txtLocation_jar= new JTextField(20);
                   btnBrowse_jar = new JButton("Browse");
                   btnBrowse_jar.addActionListener(this);
                   ActionListener updateListener = new ActionListener(){
                    public void actionPerformed(ActionEvent ae){
                     if(ae.getActionCommand().equalsIgnoreCase("Update")){               
                      System.out.println("ae.getActionCommand() :: "+ae.getActionCommand());
                      System.out.println("Update Button is pressed");               
                    *//Query :how do i access FilePath and FilePath1 here which*
    *                // has been set in public void actionPerformed(ActionEvent ae)*
    *                //method below*
    *                // FilePath  ---??*
    *                // FilePath1  ---??*
    *                // how do i access the above 2 parameters*
    *                //Query :on click of update button i have to pass*
    *                //two parameters FilePath and FilePath1 to*
    *                //perform some functionality. please help me*
    *                //to achieve this..how do i access Filepath and Filepath1*
    *                //here which has been set below.*
                     } // end of if               
                   } // end of actionPerformed
                };// end of ActionListener
                  updatebutton = new JButton("Update");
                  updatebutton.addActionListener(updateListener);
                   //adding to the panel               
                   JPanel pnl = new JPanel();
                   pnl.add(label_class);
                   pnl.add(txtLocation_class);
                   pnl.add(btnBrowse_class);
                   pnl.add(label_jar);
                   pnl.add(txtLocation_jar);
                   pnl.add(btnBrowse_jar);
                  pnl.add(updatebutton);
                   getContentPane().add(pnl);                         
         public void actionPerformed(ActionEvent ae)
              Object obj=ae.getSource();
              if(obj==btnBrowse_class)
                   final JFileChooser fcstudent = new JFileChooser();
                   int rtrnval = fcstudent.showOpenDialog(this);
                   if(rtrnval==JFileChooser.APPROVE_OPTION)
                        try
                             File file=fcstudent.getSelectedFile();                         
                             String path = file.getPath();
                             System.out.println("This is Path:"+path);
                             txtLocation_class.setText(""+path);
                             String FilePath=txtLocation_class.getText();
                             System.out.println("FilePath is ::"+FilePath);                                        
                        catch(Exception ex)               
                             ex.printStackTrace();
              }else if(obj==btnBrowse_jar){
                             final JFileChooser fcstudent = new JFileChooser();
                             int rtrnval = fcstudent.showOpenDialog(this);
                             if(rtrnval==JFileChooser.APPROVE_OPTION)
                                  try
                                       File file=fcstudent.getSelectedFile();                         
                                       String path1 = file.getPath();
                                       System.out.println("This is Path:"+path1);
                                       txtLocation_jar.setText(""+path1);
                                       String FilePath1=txtLocation_jar.getText();
                                       System.out.println("FilePath is ::"+FilePath1);                                        
                                  catch(Exception ex)               
                                       ex.printStackTrace();
         public static void main(String arg[]){
                   FileExplorer Exm= new FileExplorer();
                   Exm.setVisible(true);
    }

  • JAR file with definition of bpelc task

    Hello:
    I checked all the JAR files under c:\orapel\lib and
    did not find the definition of the 'bpelc' task, so
    I can't invoke 'ant'. Can anyone tell me the name
    and location of the JAR file that contains the
    definition of this task? Thanks...
    Regards,
    Oswald

    Ah, I just noticed that $BPEL_HOME\bin\obant.bat
    find everything that's needed....
    Oswald

  • Can't run .jar file with JavaSE

    Hello.
    I'm trying to run a .jar file with JavaSE Binary, just like I did with Windows. I Ctrl+Rclick and pick "Open with..." and there is no such option. I've been searching the whole day for a solution, I kept getting "Open Java Preferences... put on top of the list" and things like that. There is no "Java Preferences" in the Utilities folder, and nothing related to my problem in "Java Control Panel" in System Preferences. Yes, I have Java 7. I just need to run this file with Java. How?
    Thanks in advance.

    Max. allowed size of .jar file is 1MB.

  • How to run jar file with classpath?

    Hi, all,
    I have some package in my project, with which I have a java help jar file as classpath, when I run my project, I need the jh.jar file in directory /jar/jh.jar.
    Now, I bundled all my class packages into a jar file, my.jar, together with the /jar directory. When i run my jar file with command:
    java -jar my.jar
    It tells me couldn't find javahelp class.
    What shall I do? How can I create my jar file with the jh.jar?
    Thanks in advance.

    Thanks, hjembaek,
    But it doesn't work for me. I am running in windows, it still generate the error:
    Exception in thread "main" java.lang.NoClassDefFoundError: javax/help/HelpSet
    at own.gui.OwnMenuToolBar.getOwnHelpBroker(OwnMenuToolBar.java:560)
    at own.gui.OwnMenuToolBar.addHelpMenu(OwnMenuToolBar.java:327)
    at own.gui.OwnMenuToolBar.getOwnMenuBar(OwnMenuToolBar.java:188)
    at own.gui.OWNDPTool.initGui(OWNDPTool.java:55)
    at own.gui.OWNDPTool.<init>(OWNDPTool.java:39)
    at own.gui.OWNDPTool.main(OWNDPTool.java:100)
    Here is my command to generate the jar file:
    jar cfm Own.jar temp.txt help own log others
    temp.txt is the file including the main class and class path information
    I have help folder, log folder and own package, others is directory that has the jar file(others/jh.jar)

Maybe you are looking for

  • Is there a way to have external drives automatically eject on shutdown?

    Hello. First post. I've owned this laptop for about eight months now. I just purchased a second external firewire drive, and today I forgot to eject either drive before shutting down. The Mac froze up, and I had to use Applejack (which I had luckily

  • How to handle errors in a file at sender side?

    Hi I have done a file to proxy scenario. I know how to handle errors on proxy. But on sender side when picking the file if one the record have worng fomat its throwing mapping error and its not processing any record.. I wanted to process the records

  • Missing tools in CS2

    Hi, I'm trying to sort out an issue for a friend, who's using Photoshop CS2 on a Mac, running OS X 10.4.11 (Tiger). A previously working fine P'hop seems to have suddenly lost some tool useages. What's happening is when I click on, for example, the l

  • HT5390 mac os x is there a maximum on connected servers in the sidebar of the Finder window?

    Hello, I have a server with four partitions connected to my mac. At startup they automatically connect, and show up in the sidebar. Or... that's how it was for years. The new Mountain Lion sidebar shows only two of them, and it is impossible to put t

  • How to color the records in table control.

    Hi, I have created a table control in which i want to add colors to it. It is possible in reporting,but is it possible in table control.