1

I have packages that don't want to place in src folder in order to compile. Can I setup Eclipse so that other directory along with src would act as a source directory?

EDIT: When I do Build Path > Use as source folder on the folder which contains com/some_package/classes/*.java then error in Eclipse disappear but in command line compile time I get cannot find symbol error. Whereas, when I copy the same com.some_package/classes/*.java into src directory it works in eclipse and compiles command line too. How to fix command line compilation too?

4
  • So why don't you just leave the files in src? Commented Sep 3, 2014 at 6:29
  • Because I need to add 7 SDK and each one has its src packages and jars. I don't what to separate them. I want to keep the structure of each SDK in one folder. Commented Sep 3, 2014 at 6:30
  • I'd ask you to give a reproducible example. It's possible Eclipse compiles different source folders separately, though I wouldn't think it should. Commented Sep 3, 2014 at 6:41
  • I cannot, as I use cocos2d-x project. Project is huge and it is being created automatically. I don't know how it works. Commented Sep 3, 2014 at 6:53

3 Answers 3

3

Yes, you can select any folder in Eclipse, right click and choose Build Path > Use as source folder.

Sign up to request clarification or add additional context in comments.

Comments

0

Yes. Go to your Project properties -> Java Build Path. You will see Source tab there.
Use that to add your source directory.

Comments

-2

This isn't exactly an answer to your question but folks who use IntelliJ could just right click the directory --> Mark Directory As --> Sources Root.

5 Comments

Oh great. I try to pass on some information and there goes the downvote. Thanks.
The question is regarding Eclipse.
I thought it would help people using other IDE's. @SotiriosDelimanolis
Should we post answers for all IDEs? That would distract from the problem at hand, which is on Eclipse.
No worries. You can delete/edit your post. Since you're new, you should consider taking the tour and reading through the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.