?
Solved

JBuilder: Problem in importing a libarary

Posted on 2004-11-19
28
Medium Priority
?
245 Views
Last Modified: 2010-03-31
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??
0
Comment
Question by:mte01
  • 15
  • 13
28 Comments
 
LVL 13

Accepted Solution

by:
petmagdy earned 2000 total points
ID: 12628412
>> 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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12628429
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
 
LVL 3

Author Comment

by:mte01
ID: 12628439
I did all of that.....but the problem remained the same....
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 13

Expert Comment

by:petmagdy
ID: 12628455
post the error in the JBuilder log
0
 
LVL 3

Author Comment

by:mte01
ID: 12628556
"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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12628734
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
 
LVL 3

Author Comment

by:mte01
ID: 12628955
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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12629019
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
 
LVL 3

Author Comment

by:mte01
ID: 12629101
Samep problem......:(
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12629127
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
 
LVL 3

Author Comment

by:mte01
ID: 12629180
In myproject.jpx, there is cs2 (the new library).....in myproject.jpx.local there is no mention of anything related to this library?!
0
 
LVL 3

Author Comment

by:mte01
ID: 12629190
I mean there is no mention to either the new or the old......
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12629458
and offcourse u tried to rebuild all?
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12629654
if u had rebuilt all the project and  u give up (and i am nearlly to do), just reconstruct the project :-(
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12629665
one more thing is the problem class has more dependencies u didn't add to user cs2 library?
0
 
LVL 3

Author Comment

by:mte01
ID: 12632911
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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12633494
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
 
LVL 3

Author Comment

by:mte01
ID: 12635779
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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12636766
yes,
 javac -classpath PathToCs2;%CLASSPATH% ProgName.java      
0
 
LVL 3

Author Comment

by:mte01
ID: 12636785
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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12636803
yes javac path must be in ur path enviroment
0
 
LVL 3

Author Comment

by:mte01
ID: 12637949
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
 
LVL 13

Expert Comment

by:petmagdy
ID: 12638060
not in the user env. but the system env. . also to check this is done correctly from command line try:

echo %PATH%
0
 
LVL 3

Author Comment

by:mte01
ID: 12638297
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
 
LVL 3

Author Comment

by:mte01
ID: 12638308
Hint: This is how I was using the class.....:

import cs1.Keyboard.*;

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

int user = Keyboard.readInt();



:))
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12638344
suppose to be:

import cs1.*;

LOL ;-)
0
 
LVL 3

Author Comment

by:mte01
ID: 12638355
Correct........this was the problem :)............I usually use: import cs1.Keyboard;
0
 
LVL 13

Expert Comment

by:petmagdy
ID: 12638430
and it was infront of my eyes and didn't see it too
0

Featured Post

Become an Android App Developer

Ready to kick start your career in 2018? Learn how to build an Android app in January’s Course of the Month and open the door to new opportunities.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month12 days, 19 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question