Results 1 to 7 of 7
- 09-27-2012, 07:08 AM #1
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
configuring Eclipse for Art and Science of Java exercises
Hi!!! I know this was discussed in another thread on this website but I can't find it now that I've registered...
I'm doing the Stanford / iTunes U Programming Methodology Course, reading "The Art and Science of Java" and using Eclipse (the stanford version and also toying with a newer version)
I want to do the exercises in the book but every time I try to get the code up in Eclipse it tells me my classes don't exist or whatever. Yes I have imported the acm.jar file and it still goes weird.
I'm just trying to run "Hello World." I've imported EVERYTHING from the acm.jar for my project. It keeps telling me it doesn't recognise the classes I want to use. Here's the code from the book I'm trying to plug in:
import acm.graphics.*;
import.acm.program.*;
public class HelloWorld extends GraphicsProgram {
public void run() {
add(newGLabel("hello, world", 100, 75));
}
}
Sorry for the n00b question but I just want to get this up and running so I can do the exercises! This book wasn't cheap. Eclipse is completely confusing for someone just learning this stuff.
- 09-27-2012, 10:38 AM #2
Re: configuring Eclipse for Art and Science of Java exercises
Moved from New to Java
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-27-2012, 06:12 PM #3
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Re: configuring Eclipse for Art and Science of Java exercises
Is the acm.jar library on the classpath?
- 09-27-2012, 09:32 PM #4
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
- 09-28-2012, 04:50 PM #5
Member
- Join Date
- Sep 2012
- Posts
- 3
- Rep Power
- 0
Re: configuring Eclipse for Art and Science of Java exercises
Alright I googled the bejesus out of how to make a classpath and still no dice.
Here's what I do in eclipse (latest version):
Create a new java project
Import Archive File -> import acm.jar into my only project folder
Create a new class which I'm calling HelloWorld.java
Fill that class with the previously mentioned code, verbatim
Right click on the acm, click on the "Build Path" menu, select "Use as source folder"
Then all the error messages go away from the code in HelloWorld.java
I try to Run this and get the messages:
Start: applet not initialized
and in the bottom window on eclipse I see:
java.lang.ClassNotFoundException: HelloWorld.class
at sun.applet.AppletClassLoader.findClass(AppletClass Loader.java:211)
at java.lang.ClassLoader.loadClass(ClassLoader.java:3 06)
at sun.applet.AppletClassLoader.loadClass(AppletClass Loader.java:144)
at java.lang.ClassLoader.loadClass(ClassLoader.java:2 47)
at sun.applet.AppletClassLoader.loadCode(AppletClassL oader.java:662)
at sun.applet.AppletPanel.createApplet(AppletPanel.ja va:807)
at sun.applet.AppletPanel.runLoader(AppletPanel.java: 714)
at sun.applet.AppletPanel.run(AppletPanel.java:368)
at java.lang.Thread.run(Thread.java:680)
load: class HelloWorld.class not found.
Why did I get a .java file when I clicked "create new class" instead of a .class? WHat am I missing?
- 09-28-2012, 06:11 PM #6
Re: configuring Eclipse for Art and Science of Java exercises
The fundamentals, which you can learn here: Trail: Getting Started (The Java™ Tutorials)
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-28-2012, 06:51 PM #7
Moderator
- Join Date
- Jul 2010
- Location
- California
- Posts
- 1,604
- Rep Power
- 5
Re: configuring Eclipse for Art and Science of Java exercises
If you are this new to java programming, I highly recommend against using Eclipse, but rather use the command line as explained in the the link in post 6. If you forge directly into Eclipse, you will miss many fundamental concepts. If you insist on using Eclipse, there are ample examples for how to add libraries to the classpath: Project Properties -> Java Build Path -> Libraries.Why did I get a .java file when I clicked "create new class" instead of a .class? WHat am I missing?
Similar Threads
-
Configuring Java source folders for eclipse
By kfir.wolfson@gmail.com in forum EclipseReplies: 8Last Post: 10-01-2010, 12:11 PM -
Configuring tomcat in eclipse
By divya.anupindi in forum Advanced JavaReplies: 1Last Post: 09-10-2009, 08:37 AM -
Configuring PMD in eclipse
By UmaMuthu in forum EclipseReplies: 1Last Post: 08-21-2009, 01:12 PM -
Configuring Jboss with Eclipse
By javaplus in forum Advanced JavaReplies: 3Last Post: 05-07-2009, 11:16 AM -
configuring eclipse
By doug99 in forum EclipseReplies: 0Last Post: 03-09-2009, 07:32 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks