(Help) Art and Science of Java Sample Code
I'm unsuccessful at getting the sample code from the text book 'Art and Science of Java' to work on my Mac, 10.7, running Stanford's latest version of Eclipse. I can get Stanford's sample code working fine, just not the text book's code, which I found here: ftp://ftp.awl.com/cseng/authors/robe...Source%20Code/ and here The Art and Science of Java
Any help would be appreciated. I'm completely new to Java, OOP, and Eclipse.
I'm trying to get the sample code working, so I can see their Java version of 'hello, world', along with their other intro programs.
Re: (Help) Art and Science of Java Sample Code
Please post the full text of any error messages and the source code that caused the error.
Re: (Help) Art and Science of Java Sample Code
Well, I'm basically unable to import the file structure into Eclipse. Since I'm completely new, I don't understand much at this point.
The import dialogue of Eclipse says "No Projects are found to import" when selecting the folder with the files associated with it (downloaded from the links above). And the text in the book does not give any detailed instructions on how to access the files. I may have found some other related source code that may help, that enables me to import the files as a project.
I'm not sure how to import and run just a .java and .class file and run them at this point.
Re: (Help) Art and Science of Java Sample Code
Moved this to the IDE section
Re: (Help) Art and Science of Java Sample Code
Thanks!
I'm trying to find out what I need to do to compile this java file... (I'm completely new)
/*
* File: HelloProgram.java
* -----------------------
* This program displays "hello, world" on the screen.
* It is inspired by the first program in Brian
* Kernighan and Dennis Ritchie's classic book,
* The C Programming Language.
*/
import acm.graphics.*;
import acm.program.*;
public class HelloProgram extends GraphicsProgram {
public void run() {
add(new GLabel("hello, world", 100, 75));
}
}
Re: (Help) Art and Science of Java Sample Code
You will need the jar file with the acm package classes.
Re: (Help) Art and Science of Java Sample Code
Quote:
Originally Posted by
Norm
You will need the jar file with the acm package classes.
What are the steps required once you get this JAR file from the ACM taskforce website?
Re: (Help) Art and Science of Java Sample Code
The jar file with the classes needs to be on the classpath for both the javac and the java commands.
Both those commands have a commandline option: -cp
you can use to specify the classpath the command can use. See the doc for the commands.