Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Super simple: Importing into eclipse on a mac(How to import into eclipse using a mac)
Super simple: Importing into eclipse on a mac [message #698597] Tue, 19 July 2011 19:04 Go to next message
erkmania33 is currently offline erkmania33Friend
Messages: 2
Registered: July 2011
Junior Member
Hey guys.
I'm completely new to Java (taking Stanford's CS106A programming methodology online), using Eclipse on a Mac to run some pre-made karel programs, and I'm having a problem importing the assignments into Eclipse. It would be great if anybody could lend a hand.

Here's what I do to import my assignment:
I click on File>Import>Existing Projects into Workspace. Then I browse to the Assignment1 folder (under Select root directory), but when I select the Assignment1 folder, no projects appear (even though there are lots of files in the Assignment1 folder), and it doesn't let me import anything at all.

So I'm not able to import any of the assignments, worlds, or background necessary to do the assignment. Any suggestions?

Thanks in advance!
Re: Super simple: Importing into eclipse on a mac [message #698636 is a reply to message #698597] Tue, 19 July 2011 20:39 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 19-Jul-11 13:04, forums-noreply@eclipse.org wrote:
> Hey guys.
> I'm completely new to Java (taking Stanford's CS106A programmingmethodology online), using Eclipse on a Mac to run some pre-made karel programs, and I'm having a problem importing the assignments into Eclipse. It would be great if anybody could lend a hand.
>
> Here's what I do to import my assignment:
> I click on File>Import>Existing Projects into Workspace. Then I browse to the Assignment1 folder (under Select root directory), but when I select the Assignment1 folder, no projects appear (even though there are lots of files in the Assignment1 folder), and it doesn't let me import anything at all.
>
> So I'm not able to import any of the assignments, worlds, or background necessary to do the assignment. Any suggestions?
>
> Thanks in advance!

Those projects you think you have under Assignment 1 aren't Eclipse
projects. For this reason, you'll need to create a new project (Java
Project, Dynamic Web Project, etc.), then on the wizard's first page,
designate Assignment 1/project as the source for the project. Eclipse
will then create .project, .classpath, etc. in that project and it will
become an Eclipse project.

Hope this helps.
Re: Super simple: Importing into eclipse on a mac [message #698645 is a reply to message #698636] Tue, 19 July 2011 21:32 Go to previous messageGo to next message
erkmania33 is currently offline erkmania33Friend
Messages: 2
Registered: July 2011
Junior Member
Thanks for the reply!

I tried to create a new project, but it wouldn't let me for some reason (the "finish" tab is grayed out).
I took some screen shots of the steps that I took to start a new project--File>New>Project then General>Project>Next, then gave it a name (Assignment1), but it's not letting me finish.
Also here are the example files that live in the Assignment1 folder that I'm trying to put into Eclipse (they are .java, .jar., and .w)

Thanks again.
-e

index.php/fa/3398/0/
index.php/fa/3399/0/
index.php/fa/3400/0/
Re: Super simple: Importing into eclipse on a mac [message #698661 is a reply to message #698645] Tue, 19 July 2011 22:20 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 19-Jul-11 15:32, forums-noreply@eclipse.org wrote:
> Thanks for the reply!
>
> I tried to create a new project, but it wouldn't let me for some reason (the "finish" tab is grayed out).
> I took some screen shots of the steps that I took to start a new project--File>New>Project then General>Project>Next, then gave it a name (Assignment1), but it's not letting me finish.
> Also here are the example files that live in the Assignment1 folder that I'm trying to put into Eclipse (they are .java, .jar., and .w)
>
> Thanks again.
> -e

Choose a Java Project rather than a generic Project.

This said, under Assignment 1, you don't have any kind of Java project,
but just Java sources and a JAR. This wouldn't be legitimate even for
command-line javac.

In order to make an Eclipse Java Project, create a new Java Project,
with the name you want (maybe Assignment-1?), then create a package (or
packages) under the src subdirectory that corresponds to the package
directive inside your Java file(s). Right-click on a package, choose
New..., then Class and give it the name of one of your Java files. Copy
the contents of that file into the new one. (There are more
sophisticated ways to achieve this, but they're usually frustrating.)

Add a lib subdirectory to the root of your project and copy the JAR file
to it. Right-click on the project and choose Build Path -> Configure
Build Path -> Libraries -> Add JARs to add that JAR to your project
(you'll navigate to find it under that lib subdirectory you created).

Basically, I've told you here how to create a project from scratch
because your "project" on disk aren't really projects at all.
Re: Super simple: Importing into eclipse on a mac [message #777701 is a reply to message #698661] Tue, 10 January 2012 22:46 Go to previous messageGo to next message
Cameron McGregor is currently offline Cameron McGregorFriend
Messages: 2
Registered: January 2012
Junior Member
Hi Russell,

I'm trying to do the same thing as erkmania, but am running into a few problems. I have all the same files and the latest eclipse downloaded. Here's my problem(s):

1. When you say to create a package (or packages) under the src subdirectory that corresponds to the package directive inside your Java file(s). What exactly does this part mean? In the list here, which are my package directives?
I've clicked on my src subdirectory to create a new package, but I'm not sure if the package directive is the .class or .java files I've got contained. This is where I'm most confused.

2. When I go to >build path > configure build path > add JARS > my karel.jar isn't listed. I have to have to add my jar via > Add External JARS. Is there is a difference between the two? Will it matter?

Thanks much for your help and patience!

BM


Choose a Java Project rather than a generic Project.

"This said, under Assignment 1, you don't have any kind of Java project,
but just Java sources and a JAR. This wouldn't be legitimate even for
command-line javac.

In order to make an Eclipse Java Project, create a new Java Project,
with the name you want (maybe Assignment-1?), then create a package (or
packages) under the src subdirectory that corresponds to the package
directive inside your Java file(s). Right-click on a package, choose
New..., then Class and give it the name of one of your Java files. Copy
the contents of that file into the new one. (There are more
sophisticated ways to achieve this, but they're usually frustrating.)

Add a lib subdirectory to the root of your project and copy the JAR file
to it. Right-click on the project and choose Build Path -> Configure
Build Path -> Libraries -> Add JARs to add that JAR to your project
(you'll navigate to find it under that lib subdirectory you created).

Basically, I've told you here how to create a project from scratch
because your "project" on disk aren't really projects at all."
Re: Super simple: Importing into eclipse on a mac [message #777702 is a reply to message #698661] Tue, 10 January 2012 22:47 Go to previous messageGo to next message
Cameron McGregor is currently offline Cameron McGregorFriend
Messages: 2
Registered: January 2012
Junior Member
Hi Russell,

I'm trying to do the same thing as erkmania, but am running into a few problems. I have all the same files and the latest eclipse downloaded. Here's my problem(s):

1. When you say to create a package (or packages) under the src subdirectory that corresponds to the package directive inside your Java file(s). What exactly does this part mean? In the list here, which are my package directives?
I've clicked on my src subdirectory to create a new package, but I'm not sure if the package directive is the .class or .java files I've got contained. This is where I'm most confused.

2. When I go to >build path > configure build path > add JARS > my karel.jar isn't listed. I have to have to add my jar via > Add External JARS. Is there is a difference between the two? Will it matter?

Thanks much for your help and patience!

BM


Choose a Java Project rather than a generic Project.

"This said, under Assignment 1, you don't have any kind of Java project,
but just Java sources and a JAR. This wouldn't be legitimate even for
command-line javac.

In order to make an Eclipse Java Project, create a new Java Project,
with the name you want (maybe Assignment-1?), then create a package (or
packages) under the src subdirectory that corresponds to the package
directive inside your Java file(s). Right-click on a package, choose
New..., then Class and give it the name of one of your Java files. Copy
the contents of that file into the new one. (There are more
sophisticated ways to achieve this, but they're usually frustrating.)

Add a lib subdirectory to the root of your project and copy the JAR file
to it. Right-click on the project and choose Build Path -> Configure
Build Path -> Libraries -> Add JARs to add that JAR to your project
(you'll navigate to find it under that lib subdirectory you created).

Basically, I've told you here how to create a project from scratch
because your "project" on disk aren't really projects at all."
Re: Super simple: Importing into eclipse on a mac [message #777729 is a reply to message #777702] Tue, 10 January 2012 23:34 Go to previous messageGo to next message
Russell Bateman is currently offline Russell BatemanFriend
Messages: 3798
Registered: July 2009
Location: Provo, Utah, USA
Senior Member

On 10-Jan-12 15:47, Cameron McGregor wrote:
> Hi Russell,
>
> I'm trying to do the same thing as erkmania, but am running into a few problems. I have all the same files and the latest eclipse downloaded. Here's my problem(s):
>
> 1. When you say to create a package (or packages) under the src subdirectory that corresponds to the package directive inside your Java file(s). What exactly does this part mean? In the list here, which are my package directives?
> I've clicked on my src subdirectory to create a new package, but I'm not sure if the package directive is the .class or .java files I've got contained. This is where I'm most confused.
>
> 2. When I go to>build path> configure build path> add JARS> my karel.jar isn't listed. I have to have to add my jar via> Add External JARS. Is there is a difference between the two? Will it matter?
>
> Thanks much for your help and patience!
>
> BM

1. Think of packages as matching the folders or subdirectories between
src and your .java file. The package directive is:

package all.the.folders.above.my.javacode;

Take a look at
http://www.javahotchocolate.com/tutorials/use-eclipse.html to see if it
doesn't help with some of this. (It shows only one package, but you
could have more than one.)

2. Which of Add External JARs and Add JARs to use depends on whether the
JAR is in your project's filesystem or elsewhere. I think the
distinction is really whether a full filesystem path or a relative path
is generated for the .classpath file at the root of your projects. This
makes a big difference if you're sharing your project via Subversion or
another version-control system.
Re: Super simple: Importing into eclipse on a mac [message #786825 is a reply to message #777729] Mon, 30 January 2012 21:14 Go to previous message
rene askham is currently offline rene askhamFriend
Messages: 1
Registered: January 2012
Junior Member
Did you get this to work?

I have tried a lot now (total newbie just started the CS106A stanford online course) and I think I got something working:

I did like this:
1. download "assignment 1" from the Stanford site.
2. As the zip file is automatically unzipped in the download folder (on mac OS Lion), I moved the folder to the desktop, right clicked the folder, selected "compress assignment 1", then I had the zip file again.
3. In Eclipse (I use Indigo Service Release 1 - couldn't get the Stanford version to run on Lion) choose File --> Import --> General --> Existing Project into workspace --> select archive file --> browse --> assignment 1.zip (the one you compressed above) --> open.

After this I can write code and get it to work but only CollectNewspaperKarel.java! This I don't understand as assignment 1 has 4 smaller tasks, but no matter which of the 4 I write in and choose it runs CollectNewspaperKarel.java. Frustrating but for now I just write the code for each sub assignment in the collectnewspaperkarel and try it that way.

Any ideas of what I do wrong in this last part?

Previous Topic:Problem occouring with the compiler (eclipse with cygwin)
Next Topic:Opening a non-UTF-8 encoded text file?
Goto Forum:
  


Current Time: Tue Apr 23 13:58:41 GMT 2024

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

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

Back to the top