The moose likes IDEs, Version Control and other tools and the fly likes Eclipse Questions for Bill Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Practical Unit Testing with TestNG and Mockito this week in the Testing forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Reply Bookmark "Eclipse Questions for Bill" Watch "Eclipse Questions for Bill" New topic
Author

Eclipse Questions for Bill

Don Stadler
Ranch Hand

Joined: Feb 10, 2004
Posts: 451
Bill, I'm going through the example from another book (Jakarta Struts Live) in Eclipse and I've run into a slight problem.

The code I import is fairly deep in the source tree and when I import it into the project it comes up into the fully-qualified package name rather than the plain package name. I.E. I get package chapter_4.src.doc.api.strutsTutorial instead of plain package strutsTutorial. It's not a huge hangup (I just refactor->rename all the packages. But it's a pain. How do I avoid this and get Eclipse to use the packages in the java code?

The second question I have is that I'm doing a lot of similar projects and would like to use a standardized buildpath for this kind of situation. Is there a .classpath file or something I can set up instead of manually linking in the external Jars one at a time?
Dale Seng
Ranch Hand

Joined: Mar 22, 2004
Posts: 275
For your first question, it depends on "where you are" when you do the import. I just kept trying it until I got it. I haven't got the experience or the time at the moment (dinner is on the table!) to go into it more, but I'm sure you can get it. Maybe try with a tiny test project.

As to part 2, just copy the .classpath file (under workspace/(projectName).... I think that will work.

--Dale--
Bill Dudney
Author
Ranch Hand

Joined: Sep 05, 2003
Posts: 234
Originally posted by Don Stadler:

The code I import is fairly deep in the source tree and when I import it into the project it comes up into the fully-qualified package name rather than the plain package name. I.E. I get package chapter_4.src.doc.api.strutsTutorial instead of plain package strutsTutorial. It's not a huge hangup (I just refactor->rename all the packages. But it's a pain. How do I avoid this and get Eclipse to use the packages in the java code?

The second question I have is that I'm doing a lot of similar projects and would like to use a standardized buildpath for this kind of situation. Is there a .classpath file or something I can set up instead of manually linking in the external Jars one at a time?


Hi Don,

1) set 'chapter_4' as a source directory in the project properties
2) I'd use User Libraries (Window -> Preferences -> Java -> Build Path -> User Libraries)

Hope this helps!


TTFN,<br /> <br />-bd-<br /> <br /><a href="http://www.amazon.com/exec/obidos/ASIN/0471449156/qid=1064343733/sr=2-1/ref=sr_2_1/002-8375300-3666449" target="_blank" rel="nofollow">Jakarta Pitfalls</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471146153/qid=1064343733/sr=1-2/ref=sr_1_2/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">J2EE AntiPatterns</a> | <a href="http://www.amazon.com/exec/obidos/tg/detail/-/0471462071/qid=1064343733/sr=1-3/ref=sr_1_3/002-8375300-3666449?v=glance&s=books" target="_blank" rel="nofollow">Mastering JavaServer Faces</a> | <a href="http://bill.dudney.net/roller/page/bill" target="_blank" rel="nofollow">Blog</a> | <a href="http://www.jroller.com/page/BillDudney" target="_blank" rel="nofollow">Eclipse Blog</a> | <a href="http://www.sourcebeat.com/TitleAction.do?id=2" target="_blank" rel="nofollow">Eclipse 3 Live</a>
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
thank you very much, this problem was occured with me ...


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
 
 
subject: Eclipse Questions for Bill
 
Threads others viewed
Dependencies/weird problem
cannot run a simple Java app
is this about class path?
HOWTO: RAD 7.5 won't recommend standard Java packages.
Compilation error on importing class
IntelliJ Java IDE