The formidable 'NoClassDefFoundError', what caused it in this case?

Hi, thanks for reading this post!

I have two source files: file to one library, the other main program that accesses a method in the library file.

The library file is in its own packaging and packed in a JAR file. Here are the two files:
//RectangleArea.java

package AreaApplication;

public final class RectangleArea {
     public static int area(java.awt.Rectangle r) {
          return (r.width * r.height);
     }
}
//AreaApp.java

import java.awt.*;
import AreaApplication.*;

public class AreaApp {
     public static void main(String[] args) {
          int width = 10;
          int height = 5;
          
          Rectangle rec = new Rectangle(width, height);
          int area = RectangleArea.area(rec);
          System.out.println("The rectangle's area is: " + area);
     }
}
I compile the library like this file:

javac - d. RectangleArea.java

I created the JAR file with this command:

jar area.jar AreaApplication\RectangleArea.class of the cvf

Update the main program like this:

javac - cp area.jar AreaApp.java

Everything is fine up to that point.

When I ran the program:

Java - classpath area.jar AreaApp

He gave me the following error message:
java -classpath area.jar AreaApp

Exception in thread "main" java.lang.NoClassDefFoundError: AreaApp
Caused by: java.lang.ClassNotFoundException: AreaApp
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClassInternal(Unknown Source)
Could not find the main class: AreaApp.  Program will exit.
The goal here is to know how to access a class in a JAR file and learn how to compile it and run it with the CLASSPATH option.

If someone could help me understand what the problem is rather to suggest an alternative such as CLASSPATH environment variable.

Thank you in advance for your help!

Eric

Published by: er * January 11, 2011 09:42

Published by: er * January 11, 2011 10:01

In Windows, use; on Unix, use: to seprate the classpath components.
It still does not work? What the different error message?

Tags: Java

Similar Questions

  • The add-on; 'What' causes Firefox Crash

    What is; https://addons.Mozilla.org/en-us/Firefox/addon/what-about/

    Has anyone else had problems with this?

    Submitted incident reports

    Report ID
    BP-0bcbf85f-2b3d-4EB4-b6dd-b8c0a2140530=5/30/2014 13:58
    BP-7f3d1a30-df0d-4b47-8F56-6b47e2140530=5/30/2014 13:39
    BP-bc7f9e8d-56bc-4f40-89a5-75fda2140530=5/30/2014 13:38
    BP-12c174f3-0002-406a-AD11-a4fab2140530=5/30/2014 13:36

    Once a report has been filed, is BTW, possible to add information?

    Fred,

    Do you really need that the extension?

    Open topic: topic and mark this internal page. Then change this bookmark, add a keyword like maybe aa. Then aa by typing in the address bar and pressing Enter you will get topic: topic .

    Insofar as this extension causing Firefox crash goes, contact the developer using the addy email on the AMO download page.

  • I was sent a new password, but it does not accept the window. What is happening with this?

    I was sent a new password, but it does not accept the Flash Player window. Is it possible to overcome this problem so I can install it on my iMac? @

    Hi 1937woody,

    It is the OS (Apple) not Flash Player to ask for the password.  Please see what userid & password I need to install Flash Player?

    --

    Maria

  • Google Chrome installed but I have not installed it. Also the default browser configured to read a link as if it were an application for commencement. A lot of questions because I improved the MSE. What is happening with this? Also network problems.

    Since I upgraded MSE (when I did, there was a popup telling me it had not been approved for XP) I had to do system restore because it would not be updated and did not allow me update Windows.  Moreover, since the installation of a new version of CCleaner and jump into an H & R Block CD (but not installed) Google Chrome suddenly appeared as installed.  A day later, when I open IE8, it said that it was not my default browser.  It turns out that the default was trying to read the links as if they were programs to open.  These things happen in sequence, not all at once.  I'm starting to lose faith in MSE as a viable security program.  Everyone knows these issues?

    Unless you did, do you also have a Google toolbar? That install package you used for CCleaner it is where your new Chrome browser default change probably came to look always for 'extras' during the installation of the software, sometimes even when you uncheck the options such as the toolbar Google or Google Chrome as default browser and the homepage that they install any way. In the case of CCleaner you must always use the/setup package install ' Slim/No toolbar' such as the one proposed here.

    http://MajorGeeks.com/CCleaner_Slim_d4191.html

    Go to the general tab in the Internet Options and reset your default homepage and reset your default browser in "Set program access and Defaults" then uninstall Google Chrome and toolbar using Add/Remove programs. If you have had the problem of Chrome before attempting to upgrade the MSE this may have contributed to updates failed. In general you cshould use only Internet Explorer or Firefox.  When you have windows pop - up was part of Windows Genuine Advantage of message validation? If Yes, see this post here.

    http://social.answers.Microsoft.com/forums/en-us/msestart/thread/22930cda-a0bd-4263-890b-ddf812859ca4

  • PSE7 downloaded, but do not take the serial No. What should do? This old 3/2009

    I am owner PSE7 bought in 3/2009, downloaded and asked my serial No. I have, but it does not cant you help please?

    [Duplicate message deleted... Please post only once... MOD]

    Error "serial number is not valid for this product". Creative Suite

  • I asked before but everyone has discovered what causes vertical lines on the screen?

    I have vertical lines on my screen about 6 or 7 and his worst do. They go to various shades of pink, green and yellow. I asked if anyone knew the answer later when there was only 1, and even if other people had this problem no one knew the answer. Has anyone discovered yet because its getting so irritating, I think I need a new machine. Any suggestions gratefully received.

    Rupture of the membranes that make up the screen is what causes the problem.

    Rupture may be caused by indifferent manufacturing, overzealous pressure while cleaning and old age.

    Sometimes the graphics card can go wrong, but they will generally 'very bad', not just some annoying lines on the screen.

    In the end, you will have t get the screen replaced... :-)

  • Since the upgrade to El Capitan, Mail frequently continues to move emails at random in the trash. How can I stop this? emails

    After the upgrade, I started noticing that the emails were disappearing from my Inbox. I finally discovered them in the trash. As I clean the junk and Trash regularly, I've lost a few emails before I realized what was going on - very frustrating! I now control Trash before deletion which is an unnecessary pain in the you know what! Everyone knows this problem and what we can do about it?

    At the same time, I noticed that when I compose an email, it appears charges sent mail in time. What is going on? Help.  Peter

    From the Mail menu bar, you select

    ▹ mail preferences... ▹ Accounts ▹ behaviors of the ball

    and uncheck the box marked

    Store drafts on the server

  • The serial number is not qualified for this product-

    I downloaded the innstalled produced and installed by using the number shown

    I guess that S/N has been deleted (never post in a public forum). In any case, I assume that you install the version of perpetual license (full version). Whence S/N? Currently, most people receive a number that must be presented to obtain S/N. The number is not S/N, but a code to retrieve S/N. It is also possible that the installation has an upgrade. In this case, the requested S/N can be since the previous version you are upgrading. For the upgrade, you will be asked for the S/N on the previous and new versions.

  • My Apple Macbook late 2009 has been upgraded to 4 GB and Mountain Lion but runs very slowly. When I check the memory system activity monitor, I see that there are 1.6 GB inactive. Is this the cause of the slowness and what I can do?

    My Apple Macbook late 2009 has been upgraded to 4 GB and Mountain Lion but runs very slowly. When I check the memory system activity monitor, I see that there are 1.6 GB inactive. Is this the cause of the slowness and what I can do?

    Reinstall OS X from scratch and add more RAM.

    Ways to help make a slow Mac faster

    17 reasons why your Mac runs slower than expected

    Slow performance of Mac? This Article addresses!

    Difficulty of slow start in OS X | MacFixIt - CNET Reviews

    6 easy tips to speed up OS X Yosemite on your Mac.

    Avoid using third-party software that claims to clean your computer. This software does more harm than good. In addition, you don't need it. Note that all computers become slower over time even in the normal conditions of use. Generally, the experienced users erasing the hard drive and do a clean install from scratch at least once a year or every time that the installation of a major upgrade of the OS. Well sure doing so also means that you need to maintain regular and several backups.

    Add more RAM or reduce the number of simultaneously executed from applications and utilities. Remove unnecessary software such as anti-malware and that promises to clean your Mac. Look for the runaway process: Runaway applications can shorten the battery life, affect performance and increase the heat and fan acti... See also:

    Before Mavericks

    Open the activity monitor in the Utilities folder.  Select all processes in the drop process .  Click the % CPU column heading twice to display in descending order.  If find you a process that uses a large amount of time processor (> = 70,) then select the process, and then click the quit icon in the toolbar.  Click the force quit button to kill the process.  See if that helps.  Don't forget to mention the name of the runaway process, so you can find the cause of the problem.

    Mavericks and later versions

    Open the activity monitor in the Utilities folder.  Select all processes in the menu display .  Click the CPU tab in the toolbar. Click the % CPU column heading twice to display in descending order.  If you find a process that uses a large amount of CPU %, then select the process, then click on the quit icon in the toolbar.  Click the force quit button to kill the process.  See if that helps.  Don't forget to mention the name of the runaway process, so you can find the cause of the problem.

    Things you can do to solve the slow Downs

    If your computer seems to run slower, here are some things you can do:

    Start with tours: OS X maintenance - MacAttorney;

    The X Lab: the X-frequently asked questions.

    " Safe mac" Mac Performance Guide;

    " Safe mac" the myth of the dirty Mac;

    Maintenance fast Mac Help.

    Start in Safe Mode , and then repair your hard disk and permissions:

    Fix the hard disk and permissions before Lion

    Boot from your OS X install disk. After the installer loads, choose your language and click on the button continue. When the menu bar appears select utility drive in the Utilities menu. After that the charges of THE select your entry from hard drive (mfgr. ID and car size) in the list on the left.  In the status area, you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is faulty or has failed. (State SMART is not reported on external drives Firewire or USB). If the drive is "verified", then select your OS X volume in the list on the left (subentries under the entry for the road), click the first aid tab, then click the repair disk button. If THE reports any errors that have been corrected, and then run repair disk again until no errors are reported. If no errors are reported, click repair permissions. Wait until the operation is complete, then exit FROM and return to the installer.

    Repair the hard drive - Lion-Lion/mountain/Mavericks

    HD recovery start:

    Restart the computer and after the buzzer, press on and hold down the COMMAND and R until it appears the screen of Menu utilities. Otherwise, restart the computer and after the buzzer, press on and hold down the OPTION key until the Boot Manager screen. Select recovery HD disk icon and click on the button below.

    When the recovery menu appears, select disk utility. After that the charges of THE select your entry from hard drive (mfgr. ID and car size) in the list on the left.  In the status area, you will see an entry for the S.M.A.R.T. status of the hard drive.  If it does not say "Verified" then the hard drive is faulty or has failed. (State SMART is not reported on external drives Firewire or USB). If the drive is "verified", then select your OS X volume in the list on the left (subentries under the entry for the road), click the first aid tab, then click the repair disk button. If THE reports any errors that have been corrected, and then run repair disk again until no errors are reported. If no error is not reported, then click repair permissions. Wait until the operation is complete, then exit FROM and return to the main menu. Select restart from the Apple menu.

    Restart your computer normally and see if it helped at all. Then do little maintenance:

    For disk utility can't handle situations, the best third party is Disk Warriorutility;  Fixed DW only for problems with the disk directory, but most disk problems are caused by the corruption of directory; Warrior drive 4.x is now compatible with Intel Mac.

    Note: Alsoft ships DW on a bootable DVD that will boot Mac running Snow Leopard or earlier. He cannot start Mac that came with Lion or later preinstalled, however, DW will work on these models.

    Suggestions for OS X maintenance

    OS X performs certain maintenance functions that are supposed to take place on a daily, weekly, or monthly period. Maintenance scripts that are run at the beginning AM only if the computer is turned on 24/7 (no sleep). If this isn't the case, then a great solution is to download and install a shareware like Macaroni, JAW PseudoAnacronor Anacron utility that will automate the maintenance regardless of whether activity if the computer is off or asleep.  Dependence on third-party utilities to run periodic maintenance scripts has been significantly reduced since Tiger.  These utilities have little or no functionality with Snow Leopard or later version, and must not be installed.

    OS X automatically defrags files smaller than 20 MB in size, so unless you have a disk full of very large files it little need to defragment the hard drive.

    Under no circumstances should you install operating MacPaw or ZeoBit software (CleanMyMac/CleanMyDrive or Mac Keeper, respectively.) You don't need special software to keep your computer.

    Useful links about malware Protection

    "If you have an immediate problem with ads popping up see the Mac without danger" Adware removal Guide and AdwareMedic.

    Open Safari, select Preferences from the Safari menu. Click the Extensions icon in the toolbar. Disable all Extensions. If it stops your problem, then re-enable one by one until the problem returns. Now remove this extension as it is the origin of the problem.

    The following comes from user stevejobsfan0123. I made minor changes to adapt to this presentation.

    Difficulty a few pop ups browser that supported Safari

    Common pop - ups include a message saying that the Government has taken over your computer and you pay release (often called "Moneypak"), or a false message saying that your computer has been infected and you need to call a number of tech support (sometimes claiming to be Apple) to get it to be resolved. First of all, understand that these pop-ups are not caused by a virus and that your computer has not been assigned. This "hack" is limited to your web browser. Also understand that these messages are scams, so don't pay not money, call number, or provide personal information. This article will give an overview of the solution to remove the pop-up window.

    Quit Safari

    Usually, these pop-ups will not go by clicking 'OK' or 'Cancel '. In addition, several menus in the menu bar may become disabled and show in grey, including the option to leave Safari. You'll probably force quit Safari. To do this, press command + option + ESC, select Safari, press on force quit.

    Relaunch Safari

    If you restart Safari, the page will reopen. To avoid this, hold the "Shift" key when opening Safari. This will prevent windows since the last time that Safari was running since the reopening.

    It will not work in all cases. The SHIFT key must be maintained at the right time, and in some cases, even if done correctly, the window is displayed again. In these circumstances, after force quit Safari, turn off Wi - Fi or disconnect Ethernet, depending on how you connect to the Internet. Then restart Safari normally. He'll try to reload the malicious Web page, but without a connection, it will not be able to. Leave this page by entering a different URL, i.e. www.apple.com and try to load it. Now you can reconnect to the Internet and the page that you entered is displayed rather than the malicious.

    An excellent link to read is Tom Reed Mac Guide of malicious programs.

    Also, visit the FAQ XLab and read of detection and avoid malicious software and spyware.

    Check out these articles from Apple:

    Mac OS X Snow Leopard and malware detection

    OS X Lion-Protect your Mac against malicious software

    OS X Lion mountain - protect your Mac against malicious software

    OS X Mavericks-Protect your Mac against malicious software

    On the quarantine of file under OS X

    If you need antivirus protection Thomas Reed recommends to use ClamXAV. (Thanks to Thomas Reed to this recommendation.)

    The user Joe Bailey comes this equally useful advice:

    The facts are:

    1. There is no anti-malware software can detect 100% of malware out there.

    2. There is no anti-malware that can detect all targeting the Mac.

    3. the best way to prevent breaches the most is for you as the user is aware that

    the most successful malware attacks rely on sophisticated social engineering

    techniques preying on human greed, * and fear.

    4 Internet pop-up windows telling the FBI, NSA, Microsoft, your ISP has detected malware on

    your computer is designed to trick you into installing their malware thinking it's a

    protection against malware.

    5. some of the anti-malware market products are worse than malware

    go where they are supposed to protect you.

    6. be careful where you go on the internet.

    7. don't download anything from sites, you know are safe.

    8 avoid links that you receive in email, always be wary, even if you get something

    you think a friend is, but that you did not expect.

    9. If there is any question in your mind, then assume that it is malware.

    Troubleshooting Applications

    I recommend that you download a utility such as TinkerTool System, OnyX, Mavericks Cache Cleaneror hiding a Cocktail that you can use to delete the former newspapers and archives, cleaning, etc. Corrupted cache, logs or temporary files can slow down the application or OS X crashes and panics of the kernel.

    If you have leopard snow or leopard, then for similar repairs install Applejackfreeware utility.  If you do not start in OS X, you can boot into single-user mode , where you can run Applejack to make a set of routines for repair and maintenance of the command line.  Note that it takes 1.5 AppleJack for Leopard. AppleJack 1.6 is compatible with Snow Leopard. Applejack does not work with Lion and later versions.

    Basic backup

    For some people, Time Machine will be more than enough. Time Machine is part of Mac OS X. There are two components:

    1. a panel of Time Machine preferences as part of the system of preferences;

    2. a request for Time Machine, located in the Applications folder. It's

    used to manage backups and restore backups. Time Machine

    requires a backup drive that is at least twice the capacity of the

    drive being backed up.

    You can also get an external drive at least equal to the size hard disk internal and make (and maintain) a bootable clone/backup. You can make a bootable clone using the disk utility's restore option. You can also create and maintain clones with good backup software. My personal recommendations are (the order is not significant):

    1 Carbon Copy clone

    2. get backup

    3 already seen

    4 superDuper!

    5. Synk Pro

    6. Tri-Backup

    Visit The FAQ XLab and read the FAQ on the backup and restore.  Also read How to back up and restore your files. For using Time Machine, visit FAQ Time Machine of Pondini for help with all this time Machine.

    Referenced software can be found at MacUpdate .

    Additional tips

    Make sure you have a sufficient amount of RAM installed for the number of applications you run simultaneously. Make sure to leave a minimum of 10% of the capacity of the hard disk as free space.

    Add more RAM. If your computer less than 2 GB of RAM and you use OS X Leopard or later, then you can do it with more RAM. Snow Leopard and Lion works much better with 4 GB of RAM that is their system. Most concurrent applications, that you tend to use the more RAM you should have.

    Always have at least 15 GB, or 10% of the capacity of your hard disk as free space, the largest. OS X frequently accesses your hard disk, so offering enough free space will keep things slow down.

    Check for applications that may be hogging the CPU:

    Before Mavericks

    Open the activity monitor in the Utilities folder.  Select all processes in the drop process .  Click the % CPU column heading twice to display in descending order.  If find you a process that uses a large amount of time processor (> = 70,) then select the process, and then click the quit icon in the toolbar.  Click the force quit button to kill the process.  See if that helps.  Don't forget to mention the name of the runaway process, so you can find the cause of the problem.

    Mavericks and later versions

    Open the activity monitor in the Utilities folder.  Select all processes in the menu display .  Click the CPU tab in the toolbar. Click the % CPU column heading twice to display in descending order.  If find you a process that uses a large amount of time processor (> = 70,) then select the process, and then click the quit icon in the toolbar.  Click the force quit button to kill the process.  See if that helps.  Don't forget to mention the name of the runaway process, so you can find the cause of the problem.

    This problem occurs often because of a corrupted cache or the preferences file or an attempt to write in a corrupted log file.

  • The calendar on my bar side Gadgets does not always. What causes this and how can I open it?

    The calendar on my bar side Gadgets does not always.  What causes this and how can I open it?

    Hi SusanMagill,

    1. what happens when you open the calendar gadget? You receive error messages?

    2. are you facing problems with the Windows Calendar gadget?

    This problem occurs because of an error in the Windows Sidebar calendar gadget.

    Step 1:

    You can read the following article and see if it helps:

    How to restore the sidebar of Windows?

    Step 2:

    Try to rename settings.ini and check.

    a. make sure that the gadgets are completely closed (check in the Manager of tasks for sidebar.exe).

    b. open the browser, go to %localappdata%\microsoft\Windows Sidebar.

    c. save the file settings.ini in somewhere else.

    d. Rename settings.ini settings.ini.bak (or something else), it will regenerate the file. You need to add your gadgets back.

    e. open gadgets, it must be resolved.

    For more information, you can also consult the following article:

    Customize Windows Sidebar

    Hope this information is useful.

  • JSP_EXECUTION_FAILED he received for the first time today. What is cause and how this can be fixed?

    JSP_EXECUTION_FAILED

    Message received above for the first time today.  What is cause and how this can be fixed?

    See http://answers.microsoft.com/en-us/windows/forum/windows_vista-windows_programs/jspexecutionfailed-on-a-few-sites/20a56957-4abb-4142-b948-70e2a11d2f47?msgId=b899b20b-8f0d-4f3d-9115-61c5b334d08f

  • Session state protection violation: this can be caused by manually editing the protected page P67_C point. If you don't know what caused this error.

    Hi friends,

    I create three field A textfield,textfield B,C textfield and apply the formula with dynamic action.

    C = A + B.

    Now, I want to protect user could not be total change at point C, so I change it is property of the text field to display only and change in

    Settings-> save the Session State-> Yes

    After all changes when I ran page and provide the registry then it shows me error below.

    Session state protection violation: this can be caused by manually editing the protected page P67_C point. If you don't know what caused this error, contact the administrator of the application for assistance.


    How to disable the total at point C when I use the dynamic action to calculate the Total of A + B.

    Thank you.




    Hi Maxence,

    1. in the case of a display one element

    Change your point of P67_C and change the State of Session Save-> No.

    2. in the case of a text field

    Change your point of P67_C and make it read-only

    go to the attributes of the HTML Form element-> readonly = "readonly".

    Hope this helps you,

    Kind regards

    Jitendra

  • I get 'no more virtual tiles can be allocated' when you try the filter Shake reduction... anyone know what causes this error?

    I get 'no more virtual tiles can be allocated' when you try the filter Shake reduction... anyone know what causes this error? I always get on each blurry picture, I am trying to do a little better.

    This may result from the way in which the scratch disk is set up. Yo have a separate drive for the scratch?

  • In PDFs generated by FM 11, expands the wee for some paragraphs.  What causes this?

    In the PDF files that I generate using FM 11, broadens the wee for some paragraph tags.  I see no difference in the properties of the paragraph tag.  Sometimes, this causes the spread in the margin or even outside the borders of the table, as shown in the examples in the text.

    Notice that I use the option "Save as PDF".

    Please see attached examples that show the PDF output and the source of the FM about the same thing.  Note that extra word spacing does not occur in each paragraph.

    What causes this and how can I solve this problem?

    Adobe-example-1.pngAdobe-FM source-1.pngAdobe-example-2.pngAdobe-FM source-2.png

    Maybe, but here's what Microsoft said to the

    http://msdn.Microsoft.com/en-us/library/Windows/desktop/aa511282.aspx

    Segoe UI and Segoe are not the same font. Segoe UI is the Windows font for text user interface strings. Segoe is a brand used by Microsoft and its partners to produce materials for printing and advertising.

  • I tried to write a script, the user can use. This return number file *.tiff associations back using the image viewer is caused each month.

    Original title: automation of file tiff without elevated rights association

    I tried to write a script, the user can use. This return number file *.tiff associations back using the image viewer is caused each month.

    Hi, Unclemarcus2002,

    You would be wiser to post on the Forum TechNet where there is COMPUTER experts.

    http://social.technet.Microsoft.com/forums/en-us/newThread

    Maybe using the ASSOC and FTYPE command in a script will do what you want? I think that these orders would also apply the association throughout the world, rather than on a per-user basis.

    ASSOC: http:

    FTPYE: http:

    Here is an example, that you can try.

    Let's say you have a text file called "foo.bar" and you want the extension .bar always open with Notepad. There is an association for text files, so get him by typing "Ftype | more' at the command prompt (it will make a major announcement). Finally, you'll see the line "txtfile". On mine, it's "txtfile=%systemroot%\system32\notepad.exe %1" without the quotes.

    First create your association: assoc .bar = FooBarText

    Now to assign your request to your file type association: ftype FooBarText=%systemroot%\system32\notepad.exe %1

    You should now be able to double-click the foo.bar file and it will automatically open in Notepad.

    If you already have a Microsoft Office Document Imaging association, I think that it should be relatively simple type of substitution. Use ftype /? for a little more help.

    http://community.Spiceworks.com/topic/119639-Windows-7-automate-file-assocations

Maybe you are looking for