Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Error with jar file

 
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I wrote a class called Slide which had a public int method getDays() with a parameter .
It's got compiled successfully and I've imported it on my desktop as a jar file.

I have created another project and included this jar in the project which appears as Slide.class under Referenced Libraries.

But when I try to access the getDays() method or create an object of Slide in my main method, Eclipse is unable to find it.

Please advise.
 
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could you show us the code of the second project? Are you per chance forgetting to import?

Cheers
Wim
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Wim,

The problem is that when I try to write import Slide; Eclipse shows "can not be resolved".



 
Wim Vanni
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How exactly did you add this class to the build path of the new project?

Is the class Slide part of a package by any chance?
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Project A - Right Click - Configure Build Path- Add External jar under Libraries- so it appears under Referenced Libraries as JarDays.jar

Nope, Slide is in default package.

This is the class I used to create JarDays.jar

When I try to write import Jardays, I get "can not be resolved."

Please ignore import Slide statement which I wrote in the last message by mistake.

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey Wim,

It's done.

I guess I didn't import it properly.

Now it shows Slide s = new Slide(); correctly.

No need to write import statement.

Thanks
 
Wim Vanni
Ranch Hand
Posts: 96
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome

Remember to mark your question as answered!
 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Opera Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah.

Was waiting for your reply ;)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic