This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

packages and folders

 
alexandra kerr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi! my apologies if this is not the correct subforum, the question is about beginning Eclipse

I've already compiled and run the "hello world" example but I need to run an already developed (not by me) software.

This software is in many folders, with the following structure:

D:\ folder1 \ folder2 \ folder3 \ folder4

folder4 contains 9 folders : A, B, C,....H, I.

In folder B there's a folder named "TESTS" where is the main that I need to run, in the first line of that class there's the
package folder1.folder2.folder3.TESTS;

I have all the .java classes but I need to compile all of them, I created a project but I don't know how to define the folder's structure in my project, I just copied the same structure in the Eclipse workspace but it did not work.

Sorry if the question is too naive.

Alexandra
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alexandra,
Welcome to JavaRanch! No need to apologize for asking a beginner question anywhere let alone the Beginning forum

In Eclipse, there is a "src" folder in a project when you first created it. This represents the "root." So if I have the package "com.javaranch.coding.MyClass", it goes in the directory. <my project's full path>/src/com/javaranch/coding.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am going to move this to our IDEs forum since it is kind of about Eclipse.
 
alexandra kerr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks!
I'm doing something wrong:
first I created a workspace for Eclipse D\alex
then I created a project MyProject there
As you said, when I created MyProject the D\alex\MyProject\src was created.
The class that I need to compile is in C\spv7.3\cb\pfv\spv\tests it is the package: package cb.pfv.spv.tests;

I copied the folders cb\pfv\spv\tests to D\alex\MyProject\src, so now I have
D\alex\MyProject\src\cb\pfv\spv\tests

Then I do File-Open File and open the file I need to compile from D\alex\MyProject\src\cb\pfv\spv\tests
then I try to compile it Project-Build Project but nothing happens.


 
alexandra kerr
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
NOW IT WORKS!!!

Automatic compilation was turned on so i turned it off, then I refreshed the view and now could compile everything and there is a directory with the generated classes.

Now they are compiled with some warnings but no errors, thanks.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
alexandra kerr wrote:then I refreshed the view

This was the key step - Eclipse maintains its own "view" of the directories and files within a project. If you copy files, using OS tools, into or out of the project you must then refresh the project for Eclipse to use them.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34179
340
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alexandra,
Great! I'm glad to hear it is working now. And thanks for posting the solution for others who have the same problem.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic