• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

How to import a Jar correctly ?

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,

I am learning the basics of Swing / Substance look and feel.
I'd like to add some icons to my Jbuttons. (load, save, delete...)

I came across the graphic library (from java.sun.com). it comes a Jar file that contains gif files.
I've built a class path for the Jar and it is now in the "reference library" folder.

but when I try to do "import thenameofmyjar.*;" where my code is it returns an error.

basically: I know how to import the jar in my project as a reference but I don't know how to make use of it

can someone tell me how to do please?

by the way: if I download a pack of gif from the web for my interface. how would I link these gif files to my project? (do I need to create a jar file for them? if so: is there a tutorial for that? do I need to put them in a folder and reference them manually?)

thanks!
 
Marshal
Posts: 80624
470
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Find this page, then look up the links for the "java" tool. Go through that link and find the instructions about how to add the .jar to your classpath. You should use the -cp or -classpath options; don't set a system environment variable. You may need to do the same for the "javac" tool.
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And you don't import jars, you import classes.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic