0

I have an existing java project and in that project there is a procedure that should programmatically create packages with source files inside them. It uses the standard File.mkdir() method to create all the unexisting directories for the package and then creates and writes the source files in there.

All works fine except that only the top folder created for a package path is marked by Eclipse as a package. The lower level folders remain just folders. For example, if I create a directory structure for package "org.prj.hey.this.is.cool", where "org.prj" is the existing path for my main project package, it then creates the rest of the path "/hey/this/is/cool" and only "hey" becomes an Eclipse package. I have found no way to make Eclipse recognize the "this", "is" and "cool" folders as packages. I haven't found any clues on this in the .project and .classpath files either..

So how do I make the whole branch of created folders be recognized by Eclipse as packages?

UPDATE:

(screenshot)

enter image description here

Found out that the issue is due to the file extension (see the picture). Is there any way to make Eclipse recognize .clj files as source files?

Alex Miller
  • 69,183
  • 25
  • 122
  • 167
noncom
  • 4,962
  • 3
  • 42
  • 70
  • Could you post a screenshot? I am not sure I understand what the problem exactly is. – Gladhus Apr 01 '14 at 11:23
  • @Gladhus: added, but sorry, just found out that the problem is because I create not .java source files, but .clj source files (for Clojure), and Eclipse seems to fail to recognize them as such. Just tried creating a .java source and it worked... are there any ways to make Eclipse recognize .clj files as source files, universally for the IDE? – noncom Apr 01 '14 at 11:48
  • 1
    Oh, makes sens. Honestly I have no clue if such a thing is possible, maybe someone will be able to help you, at least you found why. Good luck ;) – Gladhus Apr 01 '14 at 11:52
  • @Gladhus: yeah, thanks :) gotta go asking the CounterClockWise (the Clojure IDE) people now.. :D – noncom Apr 01 '14 at 11:59

1 Answers1

0

Problem exists in your current eclipse workspace buildpath configuration. Perform rightclick on your project name, then "Build path->configure build path..." and add newly created dirs to your current build path in SOURCE tab.

Miron Balcerzak
  • 886
  • 10
  • 21