Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8448741
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T10:30:39+00:00 2026-06-10T10:30:39+00:00

This program compiles and runs swimmingly in eclipse on the same machine, but I’d

  • 0

This program compiles and runs swimmingly in eclipse on the same machine, but I’d really like to work from the command line and my editor of choice.

CollectNewspaperKarel.java

import stanford.karel.*;

    public class CollectNewspaperKarel extends SuperKarel {

        public void run() {
            // You fill in this part
        }

    }

The karel.jar is in the same directory as the file above.

Compile

javac -cp karel.jar CollectNewspaperKarel.java

with no errors.

Run

java -cp karel.jar CollectNewspaperKarel

Exception in thread "main" java.lang.NoClassDefFoundError: CollectNewspaperKarel
Caused by: java.lang.ClassNotFoundException: CollectNewspaperKarel
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T10:30:41+00:00Added an answer on June 10, 2026 at 10:30 am

    you forgot to include your class to classpath when running the program.

    Try this – if running on windows:

    java -cp karel.jar;CollectNewspaperKarel.class CollectNewspaperKarel
    

    or this if you’re running on linux:

    java -cp karel.jar:CollectNewspaperKarel.class CollectNewspaperKarel
    

    One more thing however, you need to have main method in your class, otherwise it won’t work 🙂

    Update:

    I’ve found following site: http://ycsoftware.net/setting-up-karel-the-robot-in-eclipse/

    seems, you should go with the following arguments if you have the same version of karel as the author there:

    on windows:

    java -cp karel.jar;CollectNewspaperKarel.class stanford.karel.Karel code=CollectNewspaperKarel
    

    on linux:

    java -cp karel.jar:CollectNewspaperKarel.class stanford.karel.Karel code=CollectNewspaperKarel
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Eclipse compiles and runs this jsp just fine but when I deploy to Sun
I have an MPI program which compiles and runs, but I would like to
This program in C runs and compiles well : #ifdef HAVE_CONFIG_H #include <config.h> #endif
This program runs just fine, but for some reason when I ask for an
I’ve produced a C++ program in Eclipse running on Redhat, which compiles and runs
I just realised that this program compiles and runs (gcc version 4.4.5 / Ubuntu):
Ok so my program compiles and runs perfectly well, but the purpose is to
I'm writing a program for a homework assignment. The program compiles and runs, but
This program compiles and runs on TC++ 3.0. Why don't this program compile in
My program compiles and runs correctly but after the execution, my program crashes. Below

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.