Home » Newcomers » Newcomers » Super simple: Importing into eclipse on a mac(How to import into eclipse using a mac)
|
Re: Super simple: Importing into eclipse on a mac [message #698636 is a reply to message #698597] |
Tue, 19 July 2011 20:39 |
|
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 #698661 is a reply to message #698645] |
Tue, 19 July 2011 22:20 |
|
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 |
Cameron McGregor 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 |
Cameron McGregor 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 |
|
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.
|
|
| |
Goto Forum:
Current Time: Tue Apr 23 13:58:41 GMT 2024
Powered by FUDForum. Page generated in 0.08205 seconds
|