Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-09-2008, 02:30 PM
Member
 
Join Date: Nov 2008
Posts: 4
Rep Power: 0
biba84 is on a distinguished road
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:
Quote:
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:
Quote:
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
Bookmark Post in Technorati
Reply With Quote
  #2 (permalink)  
Old 11-09-2008, 03:13 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Quote:
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.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 11-09-2008, 03:20 PM
Member
 
Join Date: Nov 2008
Posts: 4
Rep Power: 0
biba84 is on a distinguished road
Default
yes it has the full path
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 11-09-2008, 03:37 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
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.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 11-09-2008, 04:06 PM
Member
 
Join Date: Nov 2008
Posts: 4
Rep Power: 0
biba84 is on a distinguished road
Default
there is the message error I got:
Quote:
Exception in thread "main" java.lang.NoClassDefFoundError: org/archive/modules/extractor/ExtractorARC
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 11-09-2008, 05:11 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Quote:
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
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 11-09-2008, 05:46 PM
Member
 
Join Date: Nov 2008
Posts: 4
Rep Power: 0
biba84 is on a distinguished road
Default
There is the full error message:
Quote:
Exception in thread "main" java.lang.NoClassDefFoundError: ExtractorARC
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 11-09-2008, 07:46 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: SouthWest Missouri, USA
Posts: 2,229
Rep Power: 4
Norm is on a distinguished road
Default
Quote:
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:
Quote:
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.
Bookmark Post in Technorati
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


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


All times are GMT +2. The time now is 02:20 PM.



VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2009, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org