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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T11:03:09+00:00 2026-06-04T11:03:09+00:00

I am new to java programming and I am getting the much-maligned error ClassNotFoundException

  • 0

I am new to java programming and I am getting the much-maligned error “ClassNotFoundException” error.

The strange thing is is that it compiles fine:

java -cp /usr/share/java/scribe-1.3.0.jar FacebookProg

But when I try to run it, I get the following error:

steve@steve-ThinkPad-T61:~/facebook$ java  FacebookProg  
Exception in thread "main" java.lang.NoClassDefFoundError:
org/scribe/builder/ServiceBuilder  
    at FacebookProg.main(FacebookProg.java:8)  
Caused by: java.lang.ClassNotFoundException: org.scribe.builder.ServiceBuilder  
    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 more  

I checked online and it seems that java can’t find the library at runtime that it was able to find at compile time. So tried the following variations:

java -cp /usr/share/java/scribe-1.3.0.jar FacebookProg  
java -cp /usr/share/java/ FacebookProg  
export CLASSPATH="/usr/share/java"; java FacebookProf  
export CLASSPATH="/usr/share/java/usr/share/java/scribe-1.3.0.jar"; java FacebookProg  

I checked several places on StackOverflow and google and still can’t figure out why. I’m new to java, so there’s probably a simple solution, but I can’t find it. I am using Sun Java 1.6 64-bit on Ubuntu 11.04. The scribe-1.3.0.jar file is in “/usr/share/java” which, I believe, is the canonical place to put java packages.

The barebones code is here (in case it matters):

import org.scribe.builder.*;
import org.scribe.builder.api.*;
import org.scribe.oauth.*;

public class FacebookProg {
    public static void main (String args[]) {
        OAuthService service = new ServiceBuilder()
        .provider(FacebookApi.class)
        .apiKey("blah_blah")
        .apiSecret("blah_blah")
        .build();
    }
}
  • 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-04T11:03:11+00:00Added an answer on June 4, 2026 at 11:03 am

    The classpath has to point to BOTH the directory of the external library you are using AND the class you are trying to run itself. Try this:

    Windows:

    java -cp .;/usr/share/java/scribe-1.3.0.jar FacebookProg
    

    Linux:

    java -cp .:/usr/share/java/scribe-1.3.0.jar FacebookProg
    

    By the way , to compile it you should have run this:

    javac -cp /usr/share/java/scribe-1.3.0.jar FacebookProg
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to android programming. Getting Following error. 04-07 14:49:05.452: ERROR/AndroidRuntime(1566): FATAL EXCEPTION: main java.lang.OutOfMemoryError
Pretty new to Java programming, but I'm having trouble getting this to run. I
I'm quite new to java programming, but I'll try to use the correct terms
I'm new to java programming and I can't find a solution to my problem.
hi I am new here and new in Java programming as well actually my
sry about my english :) Im new to Java programming and i have a
First, i'm new at Java-programming and my native lang is not english, but still
I have been working on Eclipse recently. I am fairly new to java programming,
I am new to Android/Java programming. I have two classes, one is an Activity
Before I start know this: I am extremely new to Java and programming. How

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.