Win a copy of Learning Regular Expressions this week in the General Computing forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

Stanford CS106a help running programs  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I just started watching the videos for Stanford's CS106a course online and am trying to do the homework. I've downloaded the stanford version of eclipse and the other software as required. I can run the karel programs and the programs that come with the book (i've downloaded the ACM package aswell). I'm having trouble doing the assignments in eclipse. I've made a new project, created a file (.java) where I've put my source code. I then tried to link the acm package to the project ( Project > Properties > Project Build Path > Add External JARs). But when I run the .java file, I get the following: at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at acm.program.Program.main(Program.java:1338)

I really need some help creating a project, program in eclipse to run from scratch with the ACM package. Anny help is really appreciate. thanks
 
Marshal
Posts: 60199
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch

I suggest you stop using Eclipse at this stage, and use a decent text editor, e.g. NotePad+, Notepad2, jEdit, not Microsoft Notepad.
Create a “Java” or similar folder and put all your work in that.
Copy all the Stanford classes into the same folder structure as you are working in probably with their highest‑level folder named to match the package names (maybe “edu”).
Write out the programs in text. Write import declarations for any of the Stanford classes you need to use.
t will be rather like HelloWorld or MooseGreetings, only bigger.
 
gabe fro
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Ritchie,

Question is how do I run them in windows console? How do I import the acm package?
 
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are using a text editor, you still do the regular "import" statements in your program.

Then when you compile, set the classpath to the jar file(s). Everything (compiling and running) will be through command. So get acquainted with the javac and java commands.
 
Campbell Ritchie
Marshal
Posts: 60199
188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

gabe fro wrote: . . . Question is how do I run them in windows console?

Same way as you run MooseGreetings.

How do I import the acm package?

Same way as you import anything else.

You can cheat and put the root folder of the ACM package inside your Java folder. Then you can dispense with a classpath.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!