GeeCON Prague 2014*
The moose likes IDEs, Version Control and other tools and the fly likes packages and folders Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "packages and folders" Watch "packages and folders" New topic
Author

packages and folders

alexandra kerr
Greenhorn

Joined: Jun 05, 2010
Posts: 4
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

Joined: May 26, 2003
Posts: 30580
    
154

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

I am going to move this to our IDEs forum since it is kind of about Eclipse.
alexandra kerr
Greenhorn

Joined: Jun 05, 2010
Posts: 4
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

Joined: Jun 05, 2010
Posts: 4
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

Joined: May 14, 2008
Posts: 5835
    
    7

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.


JBoss In Action
Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 30580
    
154

Alexandra,
Great! I'm glad to hear it is working now. And thanks for posting the solution for others who have the same problem.
 
GeeCON Prague 2014
 
subject: packages and folders