Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

add jar-file in JCreator

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is this ag package for anyway?
 
reply
    Bookmark Topic Watch Topic
  • New Topic