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.

Similar Messages

  • Please Help! .jar file don't work.

    Hi, I've written a swing program that works fine when run from command prompt but it doesn't work when I create a self executable jar file and run it.
    Here's the generated classes after compiling the source file:
    TheGMailClient.class (main class)
    TheGMailClient$1.class
    MailSender.class
    MyAuthenticator.class
    I also have a GIF image file.
    Here's what written in the manifest file:
    Manifest-Version: 1.0
    Created-By: 1.4.2_05 (Sun Microsystems Inc.)
    Main-Class: TheGMailClient
    I've created the jar file with the following command:
    jar cvfm TheGMailClient.jar MANIFEST.MF -C classfiles .And here's the exceptions shown after running the jar file (I've run the jar file from command prompt using the java -jar command to view the exceptions):
    java.lang.NoClassDefFoundError: javax/mail/MessagingException
            at TheGMailClient.actionPerformed(TheGMailClient.java:238)
            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.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
            at java.awt.EventDispatchThread.run(Unknown Source)It seems to me that some classes are not found. How can I overcome this problem? Please help me guys! I'm really stuck in here.

    The error is occuring because the jar ignores the system classpath.
    You need to set your classpath in the manifest file to find the external jars.
    Otherwise the external jars will not be found.
    In your case class javax/mail/MessagingException
    For example:
    Manifest-Version: 1.0
    Created-By: 1.4.2_05 (Sun Microsystems Inc.)
    Main-Class: TheGMailClient
    Class-Path: . jars/mail.jar jars/activation.jar
    The path will need to be correct in the above related to your system.
    Also because you mention a gif image.
    You will need to add the image to the jar - you haven't.
    make sure you are loading the GIF image file in a manner that can be used from a jar.
    Image image = null;
    try {
      image = ImageIO.read(getCkass().getResource("logo.gif"));
    catch {
      // what ever
    }You may need a relative path to the image in the jar depending on where the gif is.
    For example image = ImageIO.read(getCkass().getResource("images/test.gif"));
    rykk

  • 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.

  • 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.

  • 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.

  • 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...

  • 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

  • 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.

  • 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 Jar file exception

    I have been following the example of instruction at:
    http://forum.java.sun.com/thread.jsp?forum=31&thread=332680
    But I get an exception when I do the following.
    D:\pro>jar umf mf.txt myjar.class
    java.io.IOException: invalid header field
            at java.util.jar.Attributes.read(Attributes.java:359)
            at java.util.jar.Manifest.read(Manifest.java:162)
            at java.util.jar.Manifest.<init>(Manifest.java:52)
            at sun.tools.jar.Main.update(Main.java:487)
            at sun.tools.jar.Main.run(Main.java:167)
            at sun.tools.jar.Main.main(Main.java:904)Can somebody help me on this?
    Thanks I will really appreciate.

    I cannot execute the file, after I created, and then I add the mf intothe class, I double clicked but doesn't do anything.
    Should I run it with the java -jar myjar.jar?
    When I do it it throws me the following:
    D:\z>jar cf myjar.jar myjar.class
    D:\z>jar umf mf.txt myjar.class
    D:\z>java -jar myjar.jar
    Failed to load Main-Class manifest attribute from
    myjar.jar
    D:\chris\1\z>help please.

  • SOMEONE PLEASE HELP WITH MISSING FILES XP PROBLEM

    i recently purchased an ipod touch, and all i want to do is get some music on it, and update the firmware, but i cant use itunes, cuz im getting 'there are some files missing' problem.
    I swear to god, if i dont get this fixed by the end of the week, im gonna post the latest video on youtube... on how to smash up apple products.
    Ive been trying NOT to buy apple products since the first dawn of time, but i do actually like the ipod touch. But, low and behold... the very reason why i never buy apple products has been confirmed!
    can someone PLEASE tell me if there is a solid fix for this? i have literally tried EVERYTHING before you ask. im at my wits end.
    Using XP home, all updates installed... latest itunes,

    It will probably help if you'll post the exact error message and when it's occurring. Otherwise we'll just be guessing, not that someone here might not have a good guess. I'm going to guess that this thread might help:
    http://discussions.apple.com/thread.jspa?messageID=11161893&#11161893
    Regards.

  • Please help with RTAV files and Telecini import

    Hello,
    I am trying to archive old 16mm films. I purchased a telecini and i am importing in to a Panasonic DVD video recorder and burning on to DVD. I am not sure this is important. The challenge I have is that when I put the DVD in my Powerbook g4 it opens the DVD and reads as a RTAV file. When I open the RTAV file the file is empty. I have never experienced this before and I don't even know what an RTAV file is. Please excuse my ignorance if this is basic.
    The second question I have is....I would like to import from the telecini directly in to Imove. My powerbook does not recognize the telecini which I expected. I think I need software to recognize the telecini and bridge to Imovie. Any suggestions?
    Thanks!!!
    Carla

    welcome Carla to the  iMovie boards..
    your question stumbles into some hurdles.. :
    The Panasonic dvd-corder is one of the rare devices, which allow aside the 'standard' dvd-r/w usage of socalled DVD-Ram.. which creates RTAV files.. and which are NOT readable by your Mac (=empty) ..
    so, to solve your rtav problem, use 'normal' dvd-r/+r/-rw or +rw .. (I like re-writable disks for 'transport' issues.. after transfer, erase and re-use them) ...
    I guess, your telecini (cozy name ) device offers an analogue output.. if you have a manufacturers site url, post it here, maybe we find some additional info .. if so, you need a converter device, whch converts from analogue to digital.. there are some devices, Canopus, EyeTV which are supported by iM ...
    finally: I would let do the conversion by some professional service, which allows 'transfer' to miniDV .. best quality and best compatibility..
    ahh, forgot to mention: and if you use dvd-r in your Panasonic instead of DVD-Ram, to convert such stuff, the usual reply is....... :
    DVDs are in a socalled delivery format (mpeg2), which isn't meant and made for any processing as editing...
    for using the iLife apps, you have to convert'em first, in recommended order, choose one of the following tools/workarounds:
    DVDxDV (free trial, 25$, Pro: 90$)
    Apple mpeg2 plugin (19$) + Streamclip (free)
    VisualHub (23.32$)
    Drop2DV (free, requires installation of ffmpeg parts, google for it...)
    Cinematize >60$
    Mpeg2Works >25$ + Apple plug-in
    Toast 6/7/8 allows converting to dv/insert dvd, hit apple-k
    connect a miniDV Camcorder with analogue input to a DVD-player and transfer disk to tape/use as converter
    http://danslagle.com/mac/iMovie/tips_tricks/6010.shtml
    http://danslagle.com/mac/iMovie/tips_tricks/6018.shtml
    http://karsten.schluter.googlepages.com/convertdvdstodvs
    none of these methods or tools override copy protection/DRM mechanisms.. advice on 'ripping' is a violation of the ToU of this board ..
    +be nice to copy rights ...+

  • Please help with tag files

    Hello,
    Is it possible to use to invoke tag files from other tag files in the project? Is it allowed by spec?
    1. Create empty project.
    2. Create tag file tagFile1.tag using wizard.
    3. Create tag file tagFile2.tag using wizard.
    4. Drag TagFile2 tag from toolbar to tagFile1.tag in editor pane.
    tagFile1.tag is:
    <%@ taglib tagdir="/WEB-INF/tags/" prefix="tags"%>
    <%@ tag pageEncoding="UTF-8"%>
    <tags:tagFile2/>
    tagFile2.tag is:
    <%@ tag pageEncoding="UTF-8"%>
    5. Try to rebuild the project - compilation fails
    Error(3): Unable to instantiate tag: tags:tagFile2 (class: oracle.jsp._tag._tagFile2_tag) Make sure that the tag class is available and that the tag library containing the class is not excluded from this application.
    Error(3): Unable to find class for bean: null defined by tag with class: oracle.jsp._tag._tagFile2_tag
    Is it a bug of JDeveloper or OC4J or am I duing something against the spec? Could someone please comment this behaviour.

    See update to Re: BUG: Use tag file inside another tag file gives compiler error

  • Please help with medical files I need to open immediately and cannot.

    I have some medical files sent to me that I desperately need to open. The instructions were to copy the file to the desktop, a zip file by the way, left click using the mac button and "I" at the same time. A menu would open saying "open with" and I was to choose stuffit. Then enter the password when prompted. I was able to get to the stuffit part and the password prompt and entered the password, but nothing happened. I keep getting the error message: Unable to unarchive "LoganRobertPEME.zip" into "Desktop". (Error 1-Operation not permitted.)
    Can anyone help me open this file?
    Thanks

    Contact whoever sent you the file. Perhaps it's a bad archive. Or be sure you entered the password correctly. They are case sensitive.

  • Please help with "Missing File" on iMovie 10.0.2!

    After importing clips from my GoPro to iMovie 10.0.2, the clips along with others in the same events are not available. The preview screen and thumbnail both say, "Missing File." Many of the clips that are now "missing" were uploaded and edited months ago

    Beat markers are not included in iMovie 10. Another nice feature that has gone missing in this upgrade.

Maybe you are looking for

  • Single Report for production scrap and Movement type 551 scrap

    Hi All, Can we include the scrap information from production and scrap from movement type 551 into a single BW report?.......My assumption is we cannot include it into a single report coz production scrap will have a different material information an

  • Download multiple files with 1 HttpURLConnection

    Hi, We have an application that downloads small text files (< 2 Kb) from a webserver. These files are downloaded 1 by 1 when needed. We open a HttpURLConnection, download 1 file and close the connection immediately afterwards. This is done for each f

  • ITunes refuses to recognize iPod

    Hi all, I had upgraded to the latest version of iTunes (7.1), but after a few weeks, it stopped loading completely. Instead, it began freezing 3/4 way through updating the library. I wasn't able to work my way around it, so I uninstalled ver. 7 and r

  • IDoc - JDBC, acknowledgment not possible

    Hi Guys. I've this scenario, It makes a branch, to a BPM and to a JDBC. The problem is, i got an error at the JDBC acknowledgment response (Acknowledgment not possible)                         IDOC Branch                BPM                 JDBC      

  • Sending SQL Report by eMail

    I would like to execute a sql-query and send the result by eMail. How would the syntax be? begin l_body_html := '<p>Dear Mr. Scott, </p><p>please find below dayly orders of '||:P4_DATUMWAHL||': '||select distinct artnr, produkt, inhalt, sum(anzahl) f