Skip to main content



      Home
Home » Newcomers » Newcomers » How to rename "src" to "src/java"?
How to rename "src" to "src/java"? [message #503848] Tue, 15 December 2009 19:44 Go to next message
Eclipse UserFriend
I have a project that I created the initial source folder for as "src". There are now a few packages there. I now want to change to use "src/java" so I can create at least one peer directory to "java" for other things. I would think this would be a simple thing to do, but I can't figure out how to do it.

I think it's entirely possible I could safely make this change by exiting Eclipse, creating "src/java", moving "src/*" to "src/java", then hand-edit the ".classpath" file to reflect this, then restart Eclipse. I'm a little leery of doing this, and I really should be able to do this inside Eclipse.

I tried doing a simple "rename" of "src" to "src/java", but it wouldn't let me do that.

Any ideas?
Re: How to rename "src" to "src/java"? [message #503855 is a reply to message #503848] Tue, 15 December 2009 23:38 Go to previous messageGo to next message
Eclipse UserFriend
David M. Karr wrote:
> I have a project that I created the initial source folder for as "src".
> There are now a few packages there. I now want to change to use
> "src/java" so I can create at least one peer directory to "java" for
> other things. I would think this would be a simple thing to do, but I
> can't figure out how to do it.
>
> I think it's entirely possible I could safely make this change by
> exiting Eclipse, creating "src/java", moving "src/*" to "src/java", then
> hand-edit the ".classpath" file to reflect this, then restart Eclipse.
> I'm a little leery of doing this, and I really should be able to do this
> inside Eclipse.
>
> I tried doing a simple "rename" of "src" to "src/java", but it wouldn't
> let me do that.
>
> Any ideas?


I think I might do it in two steps. First, create a second source directory
named "foo" at the same level as src, and drag all your packages from src into
foo. Then, remove the (empty) "src" source folder, create a "src/java" source
folder, and drag the packages back.

I just tried this with a small project and it worked fine. However, the output
directory is still "bin". If you want to change that to "bin/java", you can
edit the Java Build Path properties.
Re: How to rename "src" to "src/java"? [message #504026 is a reply to message #503848] Wed, 16 December 2009 10:50 Go to previous message
Eclipse UserFriend
On 12/15/09 7:44 PM, David M. Karr wrote:
> I have a project that I created the initial source folder for as "src".
> There are now a few packages there. I now want to change to use
> "src/java" so I can create at least one peer directory to "java" for
> other things. I would think this would be a simple thing to do, but I
> can't figure out how to do it.
>
> I think it's entirely possible I could safely make this change by
> exiting Eclipse, creating "src/java", moving "src/*" to "src/java", then
> hand-edit the ".classpath" file to reflect this, then restart Eclipse.
> I'm a little leery of doing this, and I really should be able to do this
> inside Eclipse.
>
> I tried doing a simple "rename" of "src" to "src/java", but it wouldn't
> let me do that.

1) Create java/ under src/ and move all your code files into src/java/
2) Open the project's properties and edit the Java Build Path > Source
tab to remove src/ and add src/java/ as a source location.

By the way, you can manually edit .classpath and save it and Eclipse
will adapt to the changes "on the fly" - no need to shut down Eclipse.

Hope this helps,
Eric
Previous Topic:Moving eclipse install from one computer to another.
Next Topic:Bundling referenced projects
Goto Forum:
  


Current Time: Mon Aug 04 00:47:14 EDT 2025

Powered by FUDForum. Page generated in 0.11542 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top