• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

using jar files  RSS feed

 
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'm sorry for this basic question....
I built a jar file , and now I want to add it to another java project.
I'm using Eclipse. I added that jar to the project and added it to the class path.
How can I call it's methods from my new class in the new project ?
Thanks.
 
Marshal
Posts: 60130
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Simply import the classes you intend to use in the .jar.

When you are not using Eclipse, you will have to use the -cp options for the java tool, or add the classpath to the manifest file in a new jar file.
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I added to the folder of my project the file hasp.jar.
I added it to the class path (with eclipse)
I write import hasp and it does nothing.
Even my jar's main class name doesn't work.
 
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without knowing more about how you're doing this it'll be hard to help.

If the library is included in the project's path then importing a class and using it will work fine: could you include the relevant portions of source (the import, how you're trying to use the import) and the specific error you get?
 
moshi cochem
Ranch Hand
Posts: 91
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I added again the jar to the classpath and now it looks fine.
I don't know what is different...
Thanks anyways.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!