Results 1 to 8 of 8
  1. #1
    biba84 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default problem with jar file

    Hello,

    I work on a web archiving project.
    The archived files have a specific format called ARC.

    for now I need to extract links from an ARC file. For that I found on the Internet a code that make what I want

    But the problem is that I want to make some changes in this code which is in a package called: org.archive.modules.extractor

    So I compiled the source : ExtractorARC.java
    as follows:
    javac -cp crawler.jar ExtractorARC.java
    and I put the generated ExtractorARC.class in the crawler.jar file after extracted it in this path: org.archive.modules.extractor

    but now when I run my class like this:
    ava -cp crawler.jar org.archive.modules.extractor.ExtractorARC 1.arc.gz
    I get this error:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/archive/modules/extractor/ExtractorARC

    I do not see where is the problem.

    What i must do please, do you have an idea.
    Regards :(

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    I put the generated ExtractorARC.class in the crawler.jar
    Did you include the full package path to the class file? The jar command should be issued when you are in the folder containing the org folder.
    Look in the jar file and see if the class file has the full path.

  3. #3
    biba84 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default

    yes it has the full path

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    "Then it should work, unless ...."
    If the jar file is in the current folder when the java command is issued and the class name in the jar file has the full package path to the class file and you've spelled the package path to class file correctly, then ...

    Could you copy and paste the full text of the console when you try executing the program? If on windows do a dir before the java command.

  5. #5
    biba84 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default

    there is the message error I got:
    Exception in thread "main" java.lang.NoClassDefFoundError: org/archive/modules/extractor/ExtractorARC

  6. #6
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    copy and paste the full text of the console when you try executing the program? If on windows do a dir before the java command.
    DO NOT EDIT or remove anything

  7. #7
    biba84 is offline Member
    Join Date
    Nov 2008
    Posts
    4
    Rep Power
    0

    Default

    There is the full error message: :)
    Exception in thread "main" java.lang.NoClassDefFoundError: ExtractorARC

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    copy and paste the full text of the console when you try executing the program? If on windows do a dir before the java command.
    YOU are NOT copying the FULL console showing the dir. Also do: jar tf crawler.jar

    Then copy the FULL CONTENTS of the console, do NOT EDIT it or remove anything. I need to see what you entered and the results.

    It should look like this:
    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    D:\JavaDevelopment\Testing>dir *.jar
    Volume in drive D is Work
    Volume Serial Number is 1463-F5AE

    Directory of D:\JavaDevelopment\Testing

    10/09/2005 09:42 AM 2,843 AppletCommBullet.jar
    10/09/2005 09:42 AM 1,784 AppletCommMain.jar
    05/26/2002 03:52 PM 18,634 AppletToDB.jar
    10/13/2008 09:07 AM 2,492 GetResource.jar
    05/30/2001 10:51 AM 4,633 JarCreator-src.jar
    05/30/2001 10:51 AM 8,189 JarCreator.jar
    10/17/2001 02:54 AM 1,891,692 java40.jar
    09/03/2008 08:48 AM 654 MTResources.jar
    06/03/2008 06:34 PM 26,180 MyJavaClasses.jar
    05/30/2001 05:12 PM 4,363 PaintAllExample.jar
    05/18/2002 08:28 AM 7,588 ScrollItUp.jar
    01/28/2008 02:38 PM 94,578 servlet-api.jar
    06/21/2001 12:57 PM 1,786 Test.jar
    08/17/2005 01:44 PM 1,884 Testing2.jar
    06/07/2002 09:57 AM 910 TestPackage.jar
    15 File(s) 2,068,210 bytes
    0 Dir(s) 20,670,808,064 bytes free

    D:\JavaDevelopment\Testing>java -cp Testing.jar asdf
    Exception in thread "main" java.lang.NoClassDefFoundError: asdf

    D:\JavaDevelopment\Testing>jar tf Testing.jar
    java.io.FileNotFoundException: Testing.jar (The system cannot find the file spec
    ified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(FileInputStream.jav a:106)
    at java.io.FileInputStream.<init>(FileInputStream.jav a:66)
    at sun.tools.jar.Main.run(Main.java:184)
    at sun.tools.jar.Main.main(Main.java:903)

    D:\JavaDevelopment\Testing>jar tf Test.jar
    ByteStringByte.class

    D:\JavaDevelopment\Testing>
    Last edited by Norm; 11-09-2008 at 07:48 PM.

Similar Threads

  1. problem - using a jar file
    By jon80 in forum New To Java
    Replies: 6
    Last Post: 07-07-2008, 08:49 AM
  2. [SOLVED] file i/o problem
    By aytidaalkuhs in forum New To Java
    Replies: 3
    Last Post: 04-06-2008, 07:42 PM
  3. problem with jar file pls help
    By jinu5 in forum New To Java
    Replies: 0
    Last Post: 08-15-2007, 11:41 PM
  4. Problem in batch file
    By marwa in forum New To Java
    Replies: 0
    Last Post: 08-14-2007, 11:24 AM
  5. problem when I try to delete a file
    By tommy in forum Advanced Java
    Replies: 2
    Last Post: 07-31-2007, 03:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •