0

In eclipse neon, I add a .jar file (Clavier.jar) and I can’t use it in my java program. It’s coming from the french book : « Programmer en java » and the autor is Claude Dellanoy. The Clavier.jar class is used in my university course to read input from a user (like the Scanner class). I already try to import the class in the .jar file and it doesn't work.

How can I get the Clavier.jar work in my java program?

Screenshot = http://prntscr.com/coc1f3

link to the Clavier.jar = http://www.grosmax.uqam.ca/prog/Inf1120/Outils/Outils.htm

crax122
  • 1
  • 2
  • Sorry, here's is the good link you just have to click on Clavier.jar to download it : http://www.grosmax.uqam.ca/prog/Inf1120/Outils/Outils.htm – crax122 Sep 30 '16 at 21:24
  • Possible duplicate of [How to use classes from .jar files?](http://stackoverflow.com/questions/460364/how-to-use-classes-from-jar-files) – shmosel Sep 30 '16 at 21:34
  • I don't think it's a duplicate. I'm in eclipse neon and I add the .jar file in the BuildPath (see Screenshot link). – crax122 Sep 30 '16 at 21:44
  • What does that have to do with what I linked? It's not enough to update the build path; you need to import the class in your code. – shmosel Sep 30 '16 at 21:45
  • If you mean to do an "import Clavier.Clavier.*;" at the beginning of the code : it's not working. I also try "import Clavier.*;" and it still not working. Maybe you can show me how you would do it ? – crax122 Sep 30 '16 at 21:46
  • 2
    It depends on which package the `Clavier` class is located in. If it's in the default package ([which it shouldn't be](http://stackoverflow.com/a/7849460/1553851)), you'll have to move your class into the default package as well, since [it can't be imported](http://stackoverflow.com/a/2030194/1553851). – shmosel Sep 30 '16 at 21:59
  • I'm agree to @shmosel. After Clavier word press ctrl + space to import the correct package – OscarSan Sep 30 '16 at 22:08
  • I'm unable to import the class. When I press Ctrl + Space I get the message : No Default Proposal. If somebody has Eclipse IDE he should try to make it run. Because here I can't. – crax122 Oct 01 '16 at 03:04
  • Quite frankly, I wouldn't bother continuing learning from a book which writes code in French (although I'm French-speaking), and provides a jar file with a class located in the default package, and thus impossible to import. That's two bad practices already. – JB Nizet Oct 01 '16 at 06:39
  • I found a solution : put the Clavier.java in the folder of the project and it work. – crax122 Oct 04 '16 at 19:14

0 Answers0