0

I've just changed to eclipse an I'm used to manually managing my project structure with Windows filesystem (compiling my .java files into bin with a batch-script). Whenever I wanted my classes to use a .png-file, I simply put this file into the .bin folder.

If I put my .png-files in the bin-folder of the eclipse project as I'm used to, the classes will be able to load the pictures just fine. But sometimes, I don't know when, Eclipse simply deletes the bin-folder and creates a new one based on the contents of the src folder (which doesn't have my .png files). Putting the files into the src-folder (again, manually from the windows file-system) doesn't actually put them in my Eclipse project.

So what I want to ask is: Why/when does Eclipse completely rebuild the bin-folder. And how can I put resources, like .png-files, into my Eclipse project?

4

1 に答える 1

1

もちろん、ファイルは必要に応じて Eclipse によって再構築される可能性があり、変更内容が失われる可能性があるため、ビンにファイルを配置しても意味がありません。

デフォルトでは、Eclipse はプロジェクトを自動的に再構築するように設定されています。[プロジェクト] メニュー エントリを見ると、その [プロジェクト] メニューで [クリーン] を選択することにより、Eclipse にプロジェクトを強制的に再構築させることができます。

これで、Eclipse がプロジェクトをビルドするタイミングをより詳細に制御できるようになりました。

リソース ファイルの追加に関して、現在のプロジェクト ディレクトリ構造がどのようなものかわかりません。プロジェクト内のディレクトリを追加/削除するには、プロジェクト エクスプローラーのサイド ペインでプロジェクト ルートを右クリックし、[プロパティ] エントリを選択します (下)、「Javaビルドパス」->「ソース」タブに移動して、プロジェクトディレクトリを管理できます。

最後に、Eclipse ではなくディスク上のファイルを変更する場合は、プロジェクト ルートを右クリックし、[更新] エントリを選択します。

お役に立てれば。

于 2013-11-10T00:23:18.517 に答える