aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes add jar-file in JCreator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "add jar-file in JCreator" Watch "add jar-file in JCreator" New topic
Author

add jar-file in JCreator

Romulus Romu
Greenhorn

Joined: Jan 21, 2004
Posts: 2
I Got a source code which has a row:
import ag.*;
now I got a jar file(ag.jar) which should contain all the classes in ag-package.
Tried to get them in the project through configure\options\jdkprofile\j2sdk1.4.03\edit->add archive->ag.jar from directory.
Do I need the row import ag.*; still? I think i do not. When compiling, it gives a error message that package ar dosn't exist, which I think is correct. But still the compiler canot recognize the classes sopposedly under
ag.jar.
When I try to extract the files from ag.jar(to get the source code package) (jar xf ag.jar)I get error message java.lang.IllegalArgumentException at java.util.Zip.zip.ZipInputStream.getUTF8String, how should I interpret that?
Does someone know how could i Examine what in jar-file? or alternatiely have I done something wrong in includin the ag.jar file, is there something else I shoul do there....?
thanks for your time.
Romulus
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

You still need the import statement. If you don't import the classes the compiler doesn't know where to find the classes you are using in your code.
For example, if you had code like:

The compiler would throw an error because it doesn't know from what package to get the File class from. So you would need to adjust your code as:

Then the compiler says, oh, you are using File and it exists in the java.io package.


GenRocket - Experts at Building Test Data
Romulu Romu
Greenhorn

Joined: Jan 22, 2004
Posts: 8
says still package ag doesn't exist, liked to see what's in the ag package, but it I try to examine it in command prompt with: jar tf ag.jar it gives error message like:
META-INF/
META-INF/MANIFEST.MF
java.lang.IllegalArgumentException
at java.util.zip.ZipInputStream.getUTF8String(ZipInputStream.java:284)
at java.util.zip.ZipInputStream.readLOC(ZipInputStream.java:237)
at java.util.zip.ZipInputStream.getNextEntry(ZipInputStream.java:73)
at sun.tools.jar.Main.list(Main.java:736)
at sun.tools.jar.Main.run(Main.java:192)
at sun.tools.jar.Main.main(Main.java:904)
Still wondering why it does'n find ag package. Is it possible that there isn't package ag under ag.jar-file?
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What is this ag package for anyway?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: add jar-file in JCreator