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 8564319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T17:10:20+00:00 2026-06-11T17:10:20+00:00

Primer: I’m starting a Java class at UCSD next week and our textbook has

  • 0

Primer:

I’m starting a Java class at UCSD next week and our textbook has us download a library called objectdraw.jar which we will be using for the first two chapters. I downloaded the library and placed it in a folder called java_libraries in my ~/home/dev/ directory.

I am trying to run my Java program on Linux and I’m getting an error when I try to run it. It compiles fine, but does not run.

To compile, I’m issuing the following command from the directory where my TouchyWindow.java file exists ~/dev/java/:

javac -classpath ../java_libraries/objectdraw.jar TouchyWindow.java

NOTE: It compiles without error or warning.

To run the program, I’m issuing the following command from the directory where my TouchWindow.class file exists ~/dev/java/:

java -classpath ../java_libraries/objectdraw.jar TouchyWindow

When I try to execute the program, I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: /home/fhaddad78/dev/java/TouchyWindow
Caused by: java.lang.ClassNotFoundException: .home.fhaddad78.dev.java.TouchyWindow
        at java.net...
        at java.security...
        at java.net...
        at java.lang...
        at sun.misc...
        at java.lang...
Could not find the main class: /home/fhaddad78/dev/java/TouchyWindow. Program will exit.

About my system:

I’m doing this on Gentoo Linux using the Iceatea Java SDK. I mention this because I’m not sure if that could cause the problem.

I’m new to Java and not really sure what this means since the file it can not find is in the path it’s saying it can’t find it in.

UPDATE
To help illustrate the program, I will past the source code as it’s only a few lines.

// TouchyWindow.java

import objectdraw.*;
import java.awt.*;

public class TouchyWindow extends WindowController {
  public void onMousePress(Location point) {
    new Text("I'm Touched", 40, 50, canvas);
  }
  public void onMouseRelease(Location point) {
    canvas.clear();
  }
}

The objectdraw.jar library file handles whatever may appear to be missing in my source file.

UPDATE
For curiosity sake, I booted into Windows, installed the Java SDK and Eclipse. Created a new project, used the same code as above, and all compiled and worked without any problems. Does that help at all with possible guidance as to the problem?

UPDATE regarding objectdraw.jar

Could this be my problem?

The following was take from the textbook’s website.

Using objectdraw with applications rather than applets
There is a simple way of using objectdraw with applications that is new with version 1.1 and later of the objectdraw library. Under these version of objectdraw, you can run extensions of WindowController (or Controller) as applications by using a new method named startController. This method is included in the Controller class (and thus is inherited by WindowController).

To turn what would have been an applet into a program that can also be run as an application, simply add the following method to your class that extends Controller or WindowController:

public static void main(String[] args) {
new MyClassName().startController(400,400);
}

In the above, MyClassName is a placeholder for the name of the class extending Controller, while the parameters (400,400) specify the size of the window desired.

  • 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-11T17:10:22+00:00Added an answer on June 11, 2026 at 5:10 pm

    You need to add the directory where the .class file exits to class path.

    The output of javac goes to a directory, let us call it BUILD_DIR. Add this build dir to class path

    java -classpath ../java_libraries/objectdraw.jar:$BUILD_DIR TouchyWindow
    

    If the TouchWindow has some package you need to add the folder where the package begin. The class name in that case will have to be packagename.packagename.ClassName

    The library expects you to use applet. It says add following to run as program

    public static void main(String[] args) { 
       new MyClassName().startController(400,400); 
    } 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basic primer: class User has_many :programs, :through => :memberships has_many :memberships end class Program
I'm learning c++ and using C++ Primer. Consider the following exercise 14.46: class Complex
In the book C++ Primer it has a code for C - style character
C++ Primer says: The identifier we define in our programs may not contain 2
Possible Duplicate: Good Primer for Python Slice Notation reverse a string in Python I've
I am reading Chapter 17 of C Primer Plus, and here is the code
Can somebody point me to a good primer on the above, and what happens
I've started to learn C++ using C++ Primer by Stephen Prate and I'm currently
I am reading the chapter function templates of C++ Primer 3rd edition , and
I'm xuggle primer and I'd like to transcode video to various formats/qualities. As a

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.