JBuilder: Problem in importing a libarary

I want to add a library whose file name is cs1 to the list of required libraries in JBuilderX, but I am having a problem on where to add it (in the Project, User Home, or JBuilder section?, do I add the folder of the .class file or the .jar file?). and when I import it it doesn't give an error, but I when I try to use it it is always giving an error...any help??
LVL 3
mte01Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

petmagdyCommented:
>> where to add it (in the Project, User Home, or JBuilder section?
user home is prefered

>>do I add the folder of the .class file or the .jar file?
in ur user defined library cs1 u add one or more jar file

after that make sure to add the library to the project libraries
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
petmagdyCommented:
to add the library u defined to the project libraries, open ur project properties and in the path node select ur (Required libraries) tab and make sure it is added
0
mte01Author Commented:
I did all of that.....but the problem remained the same....
0
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

petmagdyCommented:
post the error in the JBuilder log
0
mte01Author Commented:
"PostalOffice.java": cannot resolve symbol: variable Keyboard in class PostalOffice at line 23, column 9

where Keyboard is a class in the cs1 package....(and I did what you exactly said about adding the package in the required libraries tab....but the problem remained)
0
petmagdyCommented:
and offcourse Keyboard is in ur imports

is this a Jbuilder issue only? what if u tried to compile from command line or other IDE?
Is it possible to try this and tell me the results?
0
mte01Author Commented:
yes of course.....import cs1.Keyboard.*;

Yes I think this is a JBuilder issue only....because even sometimes in JBuilder it's working for this library.....then when I changed the location of the project.....the problem appeared, and remained in other new projects....
0
petmagdyCommented:
alright I saw this before, try this:

1- remove cs1 from ur project required library
2- delete completly the library definition from JBuilder
3- create the same library but with differenet name like cs2
4- add the new library to ur project
0
mte01Author Commented:
Samep problem......:(
0
petmagdyCommented:
ok open those files using text editior and make sure no obsolute pathes or reference to the old library name:

urproject.jpx
urproject.jpx.local
0
mte01Author Commented:
In myproject.jpx, there is cs2 (the new library).....in myproject.jpx.local there is no mention of anything related to this library?!
0
mte01Author Commented:
I mean there is no mention to either the new or the old......
0
petmagdyCommented:
and offcourse u tried to rebuild all?
0
petmagdyCommented:
if u had rebuilt all the project and  u give up (and i am nearlly to do), just reconstruct the project :-(
0
petmagdyCommented:
one more thing is the problem class has more dependencies u didn't add to user cs2 library?
0
mte01Author Commented:
Yes, I rebuilded the project,.....and I reconstructed another project & the problem remained the same.....weird

>>the problem class has more dependencies u didn't add to user cs2 library?

I didn't understand this comment....
0
petmagdyCommented:
I mean check that Keyboard has another required jars that is still missing in ur required libraries

I think u need to try to compile ur code outside JBuilder I doubt that this is only JBuilder problem, specially that u reconstructed ur project from scratch with no progress
0
mte01Author Commented:
My code compiles in the computer labs (using BlueJ) succesfully (using the library in BlueJ is rather simpler than JBuilder).....On my pc, I had no problems with JBuilder 6.0, but when I tried to use the library with JBuilder X, I am having this problem...I will compile my program in the command prompt......

To do thatm I should use:    javac ProgName.java      right??
0
petmagdyCommented:
yes,
 javac -classpath PathToCs2;%CLASSPATH% ProgName.java      
0
mte01Author Commented:
I am getting the error that javac is not recognized as an internal or external program........etc (although java is recognized....)

I have to set something in the enviroment variables...right??
0
petmagdyCommented:
yes javac path must be in ur path enviroment
0
mte01Author Commented:
I added in the user enviroment variables, the variable javac, and its path (C:\JBuilderX\bin).....but it's still not recognizing the program.......
0
petmagdyCommented:
not in the user env. but the system env. . also to check this is done correctly from command line try:

echo %PATH%
0
mte01Author Commented:
I solved the problem (in JBuilder)......it turned out to be a very stupid mistake :D.....I want petmagdy to make a wild guess of what the problem was..........:))
0
mte01Author Commented:
Hint: This is how I was using the class.....:

import cs1.Keyboard.*;

.....................
.....................

int user = Keyboard.readInt();



:))
0
petmagdyCommented:
suppose to be:

import cs1.*;

LOL ;-)
0
mte01Author Commented:
Correct........this was the problem :)............I usually use: import cs1.Keyboard;
0
petmagdyCommented:
and it was infront of my eyes and didn't see it too
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.