Help with jar files and running them

I have been trying to figure out how to run executable java files, now I have heard that a million and one people have asked this already. Though when I see the answer to these questions I am still quite confused, I would like to understand some things. First thing is how do you even save your java code as a jar file. Secondly, what is a jar file. Thirdly, I have seen many people talking about batch files, what are they? And finally, I have used many "wrappers" and I still cannot get it to work. Plz help

A quick google search gave me [url http://neptune.netcomp.monash.edu.au/JavaHelp/howto/jar.htm]this website about jars.

Similar Messages

  • Help with .h2p files and converting them

    I recently purchessed a group of loops. They downloaded in a format called .h2p. I converted one to a .wav file hoping it would open in garageband. I have read online that these files are only read by Deva. Is there a way to convert them so that they arent just for deva into .wav or .mp3 files? When I changed it from .h2p to .wav garageband said that Error -36 had occured. Please help! Thanks. FYI: I am really bad at computers and stuff like it so pretend I'm stupid. ;-)

    A quick google search gave me [url http://neptune.netcomp.monash.edu.au/JavaHelp/howto/jar.htm]this website about jars.

  • Please Help With Jar File

    I have a jar file named Helper.jar with
    com.xyz.util.Helper.class in it.
    Now I have a SrcFile.java that
    imports com.xyz.util.Helper;
    It compiles fine with:
    java -classpath Helper.jar;. SrcFile.java
    ...and runs fine with:
    java -cp Helper.jar;. SrcFile
    When I jar it with:
    jar cvfm SrcFile.jar SrcFile.mf *.class
    ...and run it with:
    java -cp Helper.jar;. -jar SrcFile.jar
    I get the following exception:
    java.lang.NoClassDefFoundError: com/xyz/util/Helper
    ...but yet, Helpler.jar runs fine with:
    java -jar Helper.jar
    Does anyone have any idea what I am doing wrong or
    do I have to un-jar the Helper.jar file and
    re-jar SrcFile.jar with all the .class files?

    I've replied to this same thread in the New To Java Technology fourm, see there for a suggestion.

  • Help with creating jar file and running it ?

    Hey guys,
    I have a program with a package called classes and a sub-package called classes.mainLib.
    I am trying to create a JAR file of the class files in mainLib. There is only one class file in classes and that contains the main method. So this is what i am doing:
    1. create a manifest file with: Main-Class: classes.Cars
    2. from within the mainLib directory (./program_name/classes/mainLib/) i do this:
    jar cvf mainLib.jar manifest ./*.class
    3. Then i move this jar file to ./program_name/lib and change directory to ./program name/
    4. try to do this: java -jar ./lib/mainLib.jar
    But it errors with:
    gary@linuxbox:~/java/cars$ java -jar ./lib/mainLib.jar
    Failed to load Main-Class manifest attribute from
    ./lib/mainLib.jar
    Any ideas why this is happening. the manifest is included in the jar'ing
    Thanks.

    At a glance, it looks like you are placing only the
    class files in the jar and trying to navigate your
    classpath to run it. Instead, you have to place ALL
    the package folders into the jar from the root of
    your package hierarchy and the jar runs anywhere, in
    any folder. The packages are INSIDE the jar.
    also I see cars/classes in a path you describe ...and
    the program seems to wnat classes/Cars ??? Could
    this be an additional issue (or am I missing seeing
    something about your package structure)?Firstly, i believe all my spelling and cases are correct.
    I have the following strcuture:
    Cars.class (contains main) : package classes in ./classes directory
    All other classes : package classes.mainLib in ./classes/mainLib
    I would like to jar ALL files in mainLib but not the class that contains the main method. Is this possible?
    I'm not sure how clear i was earlier, hope this is more understandable.

  • How to deploy ear file with jar file and war file with different names

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

    Hi,
    As part of weblogic migration from WL 6.1 sp3 to WL 10, Iam facing some problem.
    Problem:
    I have one ear file(abc.ear) to deploy which contains one jar file(xyz.jar) and one war file(pqr.war).
    In config.xml file of WL 6.1, it was mentioned as :
    <Application Deployed="true" Name="abc" Path="./config/mydomain/applications/abc.ear">
    <EJBComponent Name="xyz" Targets="myserver" URI="xyz.jar"/>
    <WebAppComponent Name="pqr" Targets="myserver" URI="pqr.war"/>
    </Application>.
    The above is working fine.
    But in config.xml file WL10,I cannot mention the same.
    I need to have different application anmes for ear,jar and war.If I deploy as a ear file,the jar and war files are deployed with the same ear file name.
    I tried the following options:
    1) Deploying as a ear file by adding <sub-deployments>
    2) Deploying both war and jar seperately which is not recommended in my application.
    Please provide the content I should place in the config.xml so that everything works fine correctly.
    Any help is appreciated.

  • Help with referenced files and importing

    This might be more complex than can be addressed here, but I'm struggling with the organization of aperture.
    Because I'm not sure I want use aperture forever, and because I occasionally like to use other photo editors, I've opted for a referenced file setup. I typically arrange my pictures into year/month sub folders, with additional folders for special subjects, like my kids. I've been doing this for a long time, it works for me, and I don't want to change.
    Problem #1 - avoiding duplicates when I import. When I stick the card in my computer I want to copy just the new files to the directory I specify. Image capture only looks for duplicates in the target directory, which is no help if I'm importing files to "November" from a card that has files that were previously imported to "October." The easiest solution would be to delete the images off of the card after importing, but I can't do that - my wife also wants to copy the pix to her computer and she may not copy for several weeks or months at a time.
    I tried using aperture's import feature to copy files directly from my camera's memory card. The import worked, but when I tried to locate the files on disk, aperture told me there were no referenced files. Any idea where they are?
    Problem #2 - import. Is there any way to make Aperture watch referenced directories and automatically add new files to the the appropriate project? It's a pain to keep manually importing files.
    Problem #3 - Organization. Is there any way to set up aperture so that a project = a physical folder on my drive? I get that Aperture is trying to abstract the physical location of my files, but I don't want them abstracted. Also, why is my aperture primary library 6.2 GB when I do all my work with referenced files? Where are my edited files stored? Are these in the primary library? Where are the files from my photostreams (from my phone) stored?
    Would any or all of these issues be resolved by moving to a managed file set up?
    Finally, if I can't get Aperture working the way I need it, any insight into how I'd use it as an external editor to something like Picasa? I really like the aperture editing tools - that's why I bought it. But the workflow is just killing me.
    Any insights would be appreciated. Thanks.

    It is not as complex as you are making it.  Aperture is not per se an editor.  It is for storing and organizing, and quickly decoding RAW images.  It is a pretty good editor, but it has the feature to allow you to specify an External Editor to which you can send images for more complex editing, and back -- all from within Aperture.
    You don't want to have your images referenced so you can also edit them with other programs.  That destroys the non destructive design of Aperture.  If you want Referenced images, you mostly want them so they can be on a different hard drive from that used by the Library for keeping track and storing the adjustments, and not so other programs can access them.
    You need to read further as to how and why Aperture works the way it does.
    Ernie

  • Urgent help with jar file

    I'm writing a program in VB that calls on a JAR file. It has been working great for weeks. Last night, I moved the JAR file to a new location on my machine, and it suddenly stopped working at all.
    I know nothing about Java. Do I need to recompile the file? I tried moving the whole directory back to its original location but it didn't help.
    Thanks in advance.

    Dude I'm telling you straight up, the program has a bug. The evidence is in the error message. Maybe the bug was not manifested before, but it was there.
    Do you have access to the source? Do you know how to compile it? You should recompile it with the -g flag to include debug information. Then the error message will include a method name and line number for the offending portion of code. If you're not able to figure it out yourself, you could post that portion of code here for someone to comment on.

  • Newbie help with JAR files

    Okay,
    I built a simple Hello World project with Swing and it worked. Now I've build my own program from scratch and get a "Cannot find the main class" error from the JRE. Below are the contents of the manafest file craeted by Sun Java Studio 8.
    Manifest-Version: 1.0
    Ant-Version: Apache Ant 1.6.2
    Created-By: 1.5.0_06-b05 (Sun Microsystems Inc.)
    Main-Class: localPkg.mainForm
    X-COMMENT: Main-Class will be added automatically by build
    Also here is the source code for localPkg.mainForm
    * mainForm.java
    * Created on January 17, 2006, 9:32 AM
    * @author rowen
    package localPkg;
    import java.beans.*;
    public class mainForm extends javax.swing.JFrame {
    /** Creates new form mainForm */
    public mainForm() {
    initComponents();
    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
    private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;
    ctoF1 = new MyBeans.CtoF();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();
    numericField1 = new magicbeans.NumericField();
    numericField2 = new magicbeans.NumericField();
    ctoF1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
    public void propertyChange(java.beans.PropertyChangeEvent evt) {
    ctoF1PropertyChange(evt);
    ctoF1PropertyChange1(evt);
    getContentPane().setLayout(new java.awt.GridBagLayout());
    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    jLabel1.setText("Farenheight");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 2;
    gridBagConstraints.ipadx = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(20, 110, 0, 0);
    getContentPane().add(jLabel1, gridBagConstraints);
    jLabel2.setText("Celsius");
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(11, 110, 0, 0);
    getContentPane().add(jLabel2, gridBagConstraints);
    numericField1.setText("farenheightField");
    numericField1.setName("farenheightField");
    numericField1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
    public void propertyChange(java.beans.PropertyChangeEvent evt) {
    numericField1PropertyChange(evt);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.gridwidth = 4;
    gridBagConstraints.ipadx = 119;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 110, 0, 160);
    getContentPane().add(numericField1, gridBagConstraints);
    numericField2.setText("celsiusField");
    numericField2.setName("celsiusField");
    numericField2.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
    public void propertyChange(java.beans.PropertyChangeEvent evt) {
    numericField2PropertyChange(evt);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 3;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.ipadx = 99;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
    gridBagConstraints.insets = new java.awt.Insets(6, 110, 191, 0);
    getContentPane().add(numericField2, gridBagConstraints);
    pack();
    // </editor-fold>
    private void numericField2PropertyChange(java.beans.PropertyChangeEvent evt) {                                            
    ctoF1.setC(numericField2.getValue());
    private void numericField1PropertyChange(java.beans.PropertyChangeEvent evt) {                                            
    ctoF1.setF(numericField1.getValue());
    private void ctoF1PropertyChange1(java.beans.PropertyChangeEvent evt) {                                     
    numericField2.setValue(ctoF1.getC());
    private void ctoF1PropertyChange(java.beans.PropertyChangeEvent evt) {                                    
    numericField1.setValue(ctoF1.getF());
    * @param args the command line arguments
    public static void main(String args[]) {
    java.awt.EventQueue.invokeLater(new Runnable() {
    public void run() {
    new mainForm().setVisible(true);
    // Variables declaration - do not modify
    private MyBeans.CtoF ctoF1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private magicbeans.NumericField numericField1;
    private magicbeans.NumericField numericField2;
    // End of variables declaration
    Using Sun Java Studio Enterprise 8 (patch 1), on Windows XP (most recent patches)
    Thanks in advance,
    Roy

    R_Owen ,
    One possible way of how to do it in JSE8 is:
    1. Put all necessary lib jars to some place under src folder.
    2. Add those jars into Compile-time libraries list (Project properties -> Libraries) for correct compilation
    3. Switch to 'Files' JSE8 tab, open manifest.mf file (it's in projects root) and add your lib jars to it.
    Syntax is:
    Class-Path: relative URLs
    That's it.
    And Class-Path attribute description from JAR File Specification:
    http://java.sun.com/j2se/1.3/docs/guide/jar/jar.html#Main%20Attributes:
    �Class-Path:
    The value of this attribute specifies the relative URLs of the extensions or
    libraries that this application or extension needs.
    URLs are separated by one or more spaces.
    The application or extension class loader uses the value
    of this attribute to construct its internal search path. �
    Copy/paste from:
    http://swforum.sun.com/jive/thread.jspa?forumID=122&threadID=60169

  • Need help with jar files

    I have made an application that uses the javax.comm library for serial port drivers. It works perfectely but when I put all the .class in a .jar and start the application it starts properly with no errors but it doesn't see the com's of the computer.
    I would apreciate if you could help me out
    greetings
    paul

    You have to modify the source code of the javax.comm class files you are using.. the line contains "package javax.comm;" should be deleted. And then compile those modified files and put the compiled files to your jar file. Or you can create a folder "javax" and subfolder "comm" in that folder and put those original .class files into "javax/comm". After that, put that "javax" folder into your jar file.

  • Need help with Jar file

    I am writing an Application in Java using swing and all that good stuff but I am currently ready to do some beta testing to find any other errors.
    The problems is I want it to be easy to use so I was just going to throw the classes ina jar file so they could just run the jar files.
    For some reason I keep getting a cannot find main class error??
    Here is the manifest file for the Jar file
    Manifest-Version: 1.0
    Created-By: 1.4.0_01 (Sun Microsystems Inc.)
    Main-Class: VRPServer.class
    VRPServer is the class that has the main in it.
    if I go to the command line and run I get
    E:\JAVA\VRP\Server>java -jar VRPServer.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: VRPServer/class
    if I double click the jar I get a pop-up saying "Could not find the main class, program will exit."
    I really don't understand Jar files all that well, I went through the tutorials but still can't see why this isn't working. Any help is appreciated. :)

    I think your problem is that you shouldn't add the '.class' to the name of your main class in your manifest; it should simply be the fully-qualified name of the class, for example:
    Manifest-Version: 1.0
    Created-By: 1.4.0_01 (Sun Microsystems Inc.)
    Main-Class: mypackage1.mypacage2.MyClassHope this is all it takes.
    Shaun

  • Help with merging files and calling SOAP adapter in BPM

    Hello All,
    I have a scenario, where am merging a header file and item file and calling a webservice in ECC. The requirement is that the no. of calls to the webservice depends on the no. of lines in the header file. Mapping is developed according to this rule and the operation mapping is also set for multiple messages. Testing the mapping produces required results.
    But when I run the scenario invoking BPM to merge the files with 2 lines in header records the webservice is called just once. On further analysis into SXMB_MONI_BPE, MESSAGES_OUPUT table in the mapping step has 2 messages. The instance ID of the message gone out shows a checkered flag with processed successfully status, but the second line is stuck in status "Transfer To Process Engine" .
    Any thoughts what I should be doing to push second message out automatically.
    Prashanth

    Hi Prashanth,
       to find out what has happened to the message try checking the workflow log,
    i.e., select the message with the 'Transfer to Process Engine" status in SXI_MONITOR and drill down in the outbound PE column.
    Once in the workflow log select 'List with Technical Detailsu2019'.
    Regards
    Kenny

  • How to compile other java files and run them from my own programs?

    I'm developing a unit testing tool for AspectJ, which can originally generate the stubs for aspect unit to be tested. All these stubs are java files. After generation of stubs, how can I program the code to compile this unit together with these stubs, i.e. how can I put the functionality of compilation and run, e.g. command "javac *.java" and "java *", into my own code.
    Hope you can understand what I mean.
    Thank you in advance.

    When I use Runtime.getRuntime().exec(command) for executing the AspectJ compile command "ajc", "IOException createProcess error=2" always occurs, while it is ok for Java comiple command "javac".
    Why this happens when I use Runtime.getRuntime().exec("ajc Hello.java Test.aj")? Is it the reason that Runtime.exec(String) may not support any command in DOS?
    (ajc is the compile command for the java file and aj file.)
    Thank you in advance.

  • Help with JAR Files

    OK, folks, I need some help here...
    And I have researched on this prior to this post, but I still don't get it.
    I have a simple application in Reminder.java file. When I compile it, I get Reminder.class and Reminder$ReminderThread.class, because I have an inner class.
    I place those files in Reminder directory. I want to make an executable JAR file, so I made a manifest file outside the Reminder directory that contains these lines
    Manifest-Version: 1.0
    Main-Class: Reminder.Remindersince the Reminder.class is within the Reminder directory, I understood I had to have a prefix "Reminder."
    In the command line, I type
    jar cmf manifest Reminder.jar Reminder/Reminder.class Reminder/Reminder$ReminderThread.classAnd I do get a Reminder.jar file, but when I double-click on it, I get a popup saying "Could not find the main class. Program will exit!"
    So, what am I doing wrong and how can I fix this? As I said, I have researched, but I can't understand what went wrong nor how to fix the problem.
    Any help will be greatly appreciated.

    Never mind, I solved it, I was missing a carriage return in my manifest file. I feel so stupid now...

  • Help with jars webstart and InputStream

    I am currently attempting to fix all the things that break
    the minute you attempt to use a jar under webstart.
    I have attempted to find an answer by searching the forums.
    I cannot determine how to overcome the following.
    I have third party jars for "Jasper reports" and the loadReport
    function requires a java.io.InputStream as input.
    "public static JasperReport loadReport(java.io.InputStream inputStream) throws JRException"
    The report templates are in my jar file in a sub directory "\sreports".
    I was loading the template with the following code.
    JasperReport template = JasperManager.loadReport(new FileInputStream(reportFile));
    Where
    String reportFile = ".\\sreports\\Std"+tableName+".jasper";
    I have tried several things including below.
    FileInputStream fs = new FileInputStream(getClass().getResource("sreports/StdEquipmentType.jasper"));
    which does not even complile.
    Rykk

    Get your input stream like:
    InputStream in = getClass().getResourceAsStream("path/to/file.txt");
    note that you use "/" and not "\" or "\\" no matter what OS you are using.

  • Now what? Help with .jar files

    Hey. I just finished a program. I want to share it with my friends or anyone else. I can create a .jar file but I have no idea what to do next. Is there an easy way to "publish" your programs (like create a .exe file?). Any help or ideas would be appreciated. Thanks, Merlot14

    java -jar MyFile.jarwill work if you've set your manifest correctly. If you're distributing only to Windows users, you could include a shortcut, I believe. Similarly, for distribution to Linux/OS X users, you could include a shell script.

Maybe you are looking for

  • Error while deploying an ear file in the Oracle Application Server

    Hi, There was an existing ear deployed in the the oracle application server - 10g. We had to include some customizations so we rebuild the ear file with the new changes and tried redeploying the ear using the EM console. Getting the below error while

  • How to use the km Discussion iViews in the enterprise portal

    hi , i need to create a discussion forum in the EP. i want to make a KM discussion iview and then to customize it so that the look and feel is also changed. i am not getting how should i start?Is PDK development needed for this? please help.

  • Fonts not appearing in CS3 program font lists

    Certain postscript fonts (ZapfDingbats and Rubino Sans) are correctly installed in Windows 7 and available to Microsoft programs (Word and Excel) but not to Adobe programs. That is, they do not appear in any of the CS3 Design Standard applications (P

  • A text on the invoice header It is copied from the customer master

    Hi need to create a text in smart form the requirement is as below It’s a text on the invoice header.It is copied from the customer master to the order than to delivery and finally on the invoice. Regards Rasheed

  • Retrieving exchanged iphone from Apple?

    This past weekend I brought my iphone 4 with a shattered screen into the Apple store (on Michigan Ave in Chicago, if that's relevant). With the $150 fee, I had it swapped out for a new phone. When I got home, I realized that I hadn't synched my phone