• Post Reply Bookmark Topic Watch Topic
  • New Topic

Error with jar file  RSS feed

 
pramod talekar
Ranch Hand
Posts: 367
Eclipse IDE Java Opera
  • 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.
 
Wim Vanni
Ranch Hand
Posts: 96
Eclipse IDE Java Oracle
  • 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 Java Opera
  • 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 Java Oracle
  • 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 Java Opera
  • 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 Java Opera
  • 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 Java Oracle
  • 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 Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yeah.

Was waiting for your reply ;)
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!