Can't Run Java Programs -- java.lang.NoClassDefFoundError Error

I am running 10.4.11. For some reason I can no longer run Java programs. (I could in the past)
For example. I create a simple Hello World program as follows and save it as Hello.java:
class HelloWorld
public static void main (String args[])
System.out.println("Hello, world!");
Then I compile it:
Javac Hello.java
Then I try to run it:
java Hello
But I get this error:
Exception in thread "main" java.lang.NoClassDefFoundError: Hello
I think it must be a CLASSPATH problem but normally you do not need to worry about ClassPATH. Apple sets it up for you out of the box.
What is wrong?

I totally forgot that the class name should be the same as the filename.
After I renamed the file to HelloWorld.java and recompiled, I could run "java HelloWorld"
Rob

Similar Messages

  • After compile can not run the program

    package MyPack;
    class Balance
    String name;
    double bal;
    Balance(String n,double b)
    name=n;
    bal=b;
    void show()
    if(bal<0)
    System.out.println("--->");
    System.out.println(name+" " +bal);
    class Account
    public static void main(String args[])
    Balance current[] = new Balance[3];
    current[0]= new Balance("xxx", 2500);
    current[1]= new Balance("yyy", 1500);
    current[2]= new Balance("zzz", 3500);
    for(int i=0;i<3;i++)
    current.show();
    here i have written a program on using package after complieing this program, and run this program i get the error of file not found. can u please gide to run this program.

    after writing this program i saved in the folder c:\MyPack\ and run the program from the same folder by using this command first by javac Accounts.java. then, java MyPack.Accounts and i get this error
    exception in thread "main" java.lang. No ClassDefFoundError:MyPack/Accounts. even though i made sure i have the java class file in the same folder.

  • Can't run some programs after system restore to remove virus

    Hi,
    My duaghter's Toshiba had a nasty virus that pretended to be an antivirus software product, that snuck in, between the time her default Norton service expired and I had the time to install Trend.
    Could not remove it using Trend, so upon advice from a friend, decided to do a windows system restore to a point prior to the infection. This worked successfully, and the virus is gone, but now she can't run some programs, I have tried to install Trend again, but that fails as it says that you have to uninstall Norton first. But I can't run Norton, or uninstall it, and some folders on C: are no longer accessible.
    Should I do a complete Toshiba system restore (ie back tofactory settings? This seems a drastic measure, but the issue is beyond my meagre PC skills.
    Thanks,
    Graeme

    Thanks for your reply.
    The main issue is that we cannot run the Norton Anitvirus that came prepackaged with the laptop, and we can't uninstall it either. If you try to perform either action, nothing happens.
    However, when we try to install a new antivirus software, Trend, the install fails because it detects that Norton is installed, and indicates that we must uninstall Norton before we can complete the Trend installation. But we cannot unistall Norton for some reason.
    I am getting my daughter to check what else doesn't work, but Microsoft Office works OK, and most of the games she installed seem to work. I just don't understand why Norton won't work now, and why we cannot uninstall it. I don't know if its due solely to the system restore, or some combination of events. The introductory 3 mont Norton licence has expired some time ago, but it should still let us uninstall. I have also tried to unistall through the Control panel, but nothing happens when I try that either.
    Is there any way to force the uninstall of Norton? Or is a factory reset the only viable option now?
    Thanks,
    Graeme

  • I own an iMac 2011. I am unable to reinstall and launch premiere pro cc. We I attempt to run the program I get a error message saying that the adobe application manager is missing or need to be updated. I reinstalled the manager but I am still unable to l

    I own an iMac 2011. I am unable to reinstall and launch premiere pro cc. We I attempt to run the program I get a error message saying that the adobe application manager is missing or need to be updated. I reinstalled the manager but I am still unable to launch any of my programs from adobe. I tried to do a trail with a program and I am still getting the same message.

    Davinci thank you for the update.
    Please utilize any available uninstallers that are located in the Applications/Utilities/Adobe Installers folder.  Once all of the available uninstallers have been run you will then want to rerun the CC Cleaner Tool.  You can find directions on the use of the CC Cleaner Tool and a download link at Use the CC Cleaner Tool to solve installation problems | CC, CS3-CS6 - http://helpx.adobe.com/creative-suite/kb/cs5-cleaner-tool-installation-problems.html.  After the CC Cleaner Tool is run then please reinstall the Creative Cloud Desktop application from Creative Cloud Help | Creative Cloud for desktop.
    The CC Cleaner Tool is designed to be used after running the uninstallers.  Without running the uninstallers first then a complete removal may not be possible.

  • Every time I try to run a java program: Java.lang.ClassNotFoundException?

    I downloaded the JDK version 6 successfully for my laptop which runs windows 7 (64bit). I'm trying to run programs that I have successfully run at school on my computer put it doesn't work. I pull up the command prompt and enter javac "program name".java and it compiles fine. Then, when I type java "program name" it gives me the Java.lang.ClassNotFoundException. Can anyone please help me??

    Try:
    java -cp . ClassNameNote the dot.

  • "java.lang.NoClassDefFoundError" error while run t-code SXMB_IFR in XI

    Hi
    When I am trying to run t-code <b>SXMB_IFR</b> in Xi it give me below error.
    <b>Exception Details
    Exception class: java.lang.NoClassDefFoundError
    Message
    java.lang.NoClassDefFoundError
    Stacktrace
    Thrown:
    java.lang.NoClassDefFoundError: null
         at com.sap.aii.ibrep.server.transport.api.RepTransportServiceStartup.startupIbrepTransportServices(RepTransportServiceStartup.java:22)
         at com.sap.aii.ibrep.server.applcomp.StartupCodeEntry.startup(StartupCodeEntry.java:426)
         at com.sap.aii.ib.core.applcomp.IStartupCodeEntry.startupIfNotAlreadyDone(IStartupCodeEntry.java:33)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponentImpl.startup(ExplicitApplicationComponentImpl.java:116)
         at com.sap.aii.ib.core.applcomp.ExplicitApplicationComponents.startup(ExplicitApplicationComponents.java:374)
         at com.sap.aii.ib.core.applcomp.ApplicationComponent.startup(ApplicationComponent.java:201)
         at jsp_Main1172666584171._jspService(jsp_Main1172666584171.java:21)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:467)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:181)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:385)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:263)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:340)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:318)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:821)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:239)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:147)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:37)
         at com.sap.engine.core.cluster.impl6.session.UnorderedChannel$MessageRunner.run(UnorderedChannel.java:71)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:94)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:162)</b>
    Reg,
    Hiren Patel

    Hi Hiren,
       Check these threads:
    Problem starting SXMB_IFR and J2EE Engine
    java.lang.NoClassDefFoundError
    Regards,
    Subhasha Ranjan

  • How can I run other programs using java program

    hi experts,
    I am trying to execute a set of commands from java program
    eg: from command prompt
    java CommandExecutor c:\winnt\notepad.exe c:\some.exe c:\onemorecommand.exe
    and inside the CommandExecutor main method..
    public static void main(String []arg)
    for(i = 0; i < arg.length; i++)
    Runtime.getRuntime().exec(arg(i));
    the above code is executing all the command one after the other, but I want to execute the above commands squentially, i.e I want to execute the second command only after finishing the first command and the third after finishing the second and so on depending upon the arguments passed, how can I acheive this...
    I have tried to use the Process which is returned by the exec(arg) method but the exitValue() returns same value before execution and after execution.
    thanks,
    krishna

    Did you try to get the process returned and then try
    process.waitFor() method. This waits for the process to finish.
    After that try the next execution

  • "java.lang.NoClassDefFoundError "Error message

    Could someone please me out with regards to the below shown error messages? I successfully compiled a java program called "HelloWorld.java" but got the error messages below when i tried to run/execute the java program in question. How could i rectify this problem? I look forward to hearing from anyone wishing to help.
    java.lang.NoClassDefFoundError: HelloWorld
    Exception in thread "main"

    Hi,
    I also encounter this problem. Can u pls guide me cos i'm don't really understand how u all solve the problem. What Should i change in the classpath... ThankS! Pls help

  • Using tesing, i can't run any swing java application.

    Any swing application, ex. xxe or openproj.
    Using openjdk6, i got those error:
    env:
    [hubert@hubert-dell bin]$ java -version
    java version "1.6.0_0"
    OpenJDK Runtime Environment (IcedTea6 1.5pre-r059f6ba0c7dd) (ArchLinux-1.5_hg20090429-1-x86_64)
    OpenJDK 64-Bit Server VM (build 14.0-b10, mixed mode)
    error:
    [hubert@hubert-dell bin]$ ./xxe
    internal error: cannot create application: java.lang.UnsatisfiedLinkError: Can't load library: /usr/lib/jvm/java-1.6.0-openjdk/jre/lib/amd64/motif21/libmawt.so
    +---------------------------------------
    | java.lang.ClassLoader.loadLibrary(ClassLoader.java:1666)
    | java.lang.Runtime.load0(Runtime.java:787)
    | java.lang.System.load(System.java:1022)
    | java.lang.ClassLoader$NativeLibrary.load(Native Method)
    | java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1767)
    | java.lang.ClassLoader.loadLibrary(ClassLoader.java:1684)
    | java.lang.Runtime.loadLibrary0(Runtime.java:840)
    | java.lang.System.loadLibrary(System.java:1047)
    | sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:67)
    | sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:47)
    | java.security.AccessController.doPrivileged(Native Method)
    | java.awt.Toolkit.loadLibraries(Toolkit.java:1610)
    | java.awt.Toolkit.<clinit>(Toolkit.java:1632)
    | java.awt.Color.<clinit>(Color.java:279)
    | javax.swing.plaf.metal.MetalTheme.<clinit>(MetalTheme.java:76)
    | javax.swing.plaf.metal.MetalLookAndFeel.getCurrentTheme(MetalLookAndFeel.java:1681)
    | javax.swing.plaf.metal.MetalLookAndFeel.createDefaultTheme(MetalLookAndFeel.java:1576)
    | javax.swing.plaf.metal.MetalLookAndFeel.getDefaults(MetalLookAndFeel.java:1598)
    | javax.swing.UIManager.setLookAndFeel(UIManager.java:545)
    | javax.swing.UIManager.setLookAndFeel(UIManager.java:585)
    +---------------------------------------
    then i change java-runtime to sun java sdk.
    env:
    [hubert@hubert-dell bin]$ java -version
    java version "1.6.0_13"
    Java(TM) SE Runtime Environment (build 1.6.0_13-b03)
    Java HotSpot(TM) 64-Bit Server VM (build 11.3-b02, mixed mode)
    [hubert@hubert-dell bin]$
    error:
    [hubert@hubert-dell bin]$ ./xxe
    # An unexpected error has been detected by Java Runtime Environment:
    # SIGSEGV (0xb) at pc=0x00007f02743bb438, pid=16636, tid=139648504359248
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (11.3-b02 mixed mode linux-amd64)
    # Problematic frame:
    # C [libc.so.6+0x30438] catgets+0x18
    # An error report file with more information is saved as:
    # /tmp/hs_err_pid16636.log
    # If you would like to submit a bug report, please visit:
    # http://java.sun.com/webapps/bugreport/crash.jsp
    # The crash happened outside the Java Virtual Machine in native code.
    # See problematic frame for where to report the bug.
    ./xxe: line 40: 16636 已放弃 java $mem $opt -DXXE_GUI="$XXE_GUI" -DXXE_ADDON_PATH="$XXE_ADDON_PATH" -DXXE_USER_PREFERENCES="$XXE_USER_PREFERENCES" -classpath "$cp" com.xmlmind.xmleditapp.start.Start "$@"
    [hubert@hubert-dell bin]$
    My archlinux:
    [hubert@hubert-dell ~]$ uname -a
    Linux hubert-dell 2.6.29-ARCH #1 SMP PREEMPT Wed Apr 29 15:36:46 CEST 2009 x86_64 Intel(R) Core(TM)2 CPU T7200 @ 2.00GHz GenuineIntel GNU/Linux
    [hubert@hubert-dell ~]$ yaourt -Q glibc openjdk6 kernel26
    ==> List all installed packages
    local/glibc 2.9-7
    local/openjdk6 1.5_hg20090429-1
    local/kernel26 2.6.29.2-1
    [hubert@hubert-dell ~]$
    Last edited by hubertstar (2009-04-30 17:15:28)

    ok, this's not a bug.
    I'm install eioffice(Yongzhong office, a chinese office software) and test it, and i have to set AWT_TOOLKIT=MToolkit (Running eio with compiz).
    That's the problem.
    unset AWT_TOOLKIT
    no errors.

  • "java.lang.NoClassDefFoundError: error

    Hi
    I am getting this error on running my application. Please suggest somethin. It's really urgent.
    "java.lang.NoClassDefFoundError: com.tangosol.coherence.component.util.daemon.queueProcessor.service.DistributedCache"

    Hi,
    It look like your classpath is not configured properly.
    Depending on the Coherence version you use, you need to ensure that you have either coherence.jar (3.4) or both coherence.jar and tangosol.jar (3.3 or earlier) in a classpath.
    Not sure if this will be helpful or not, but it's hard to provide more help without knowing more about your environment, as Rob mentioned.
    Regards,
    Aleks

  • I can not run or compile java programme

    I am first time java programmer I can not run or compile any java programme.
    (can not read
    1 error) this is the the message that I am getting from my dos

    http://java.sun.com/docs/books/tutorial/getStarted/cupojava/index.html
    Try the tutorial.
    It sounds like your error message comes from compiling. For example, "javac mysourcecode.java" If that is correct, the most common trouble comes from using a program like Notepad on Windows to create the soruce code. The tutorial will walk your through it.

  • Java.lang.NoClassDefFoundError error on sun one 6.0 web server

    Hello,
    I'm trying to run a simple hello_world test but get an error message as follows
    [17/Nov/2003:12:49:55] info (23151): Internal Info: loading servlet /test/hello_
    world.jsp
    [17/Nov/2003:12:49:56] failure (23151): Internal error: Unexpected error conditi
    on thrown (java.lang.NoClassDefFoundError: sun/tools/javac/Main,sun/tools/javac/
    Main), stack: java.lang.NoClassDefFoundError: sun/tools/javac/Main
    at com.iplanet.server.http.servlet.IWSJavaC.compile(IWSJavaC.java, Compi
    led Code)
    at com.iplanet.server.http.servlet.IWSJavaCompiler.compile(IWSJavaCompil
    er.java:73)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled C
    ode)
    at com.iplanet.server.http.servlet.NSServletEntity.load(NSServletEntity.
    java, Compiled Code)
    at com.iplanet.server.http.servlet.NSServletEntity.update(NSServletEntit
    y.java, Compiled Code)
    at com.iplanet.server.http.servlet.NSServletRunner.Service(NSServletRunn
    er.java, Compiled Code)
    Here is my web-apps.xml file ->
    # pg web-apps.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE vs PUBLIC "-//Sun Microsystems, Inc.; iPlanet//DTD Virtual Server Web
    Applications 6.0//EN"
    "http://developer.iplanet.com/webserver/dtds/iws-webapps_6_0.dtd">
    <vs>
    <web-app uri="/hello_world" dir="/nnn.nnn.nnn.nn/test" enable="true"/>
    </vs>
    Just erased ip just in case.
    Has anyone experinced same behaviour?

    What service pack of 6.0 server are you using? What is the JDK version? Try running the VM in server mode. Here's the docs to run JVM in server mode:
    http://docs.sun.com/source/816-6770-10/rn60sp6.html#1017482
    Hope it helps.
    Thanks,
    Manish

  • Can I run both legacy Java and the latest version on my Macbook

    My CS4 Indesign now says I need the legacy Java version to run it. I upgraded to Yosemite and use CC 2014 Photoshop, but don't want to upgrade my Indesign as I don't use it much, but I do want it available. Can I run two versions of Java on the same machine?

    I'm pretty sure that that's not possible.
    CS4 is not guaranteed to work under Mavericks or Yosemite so you're on your own.

  • Issue with launching Java Program - Java Library Problem?

    I hope this is the right forum, I apologize if it isn't. I am having issues launching a program for a video game that uses java. One of the devs told me to post my issue here, as he doesn't know how much more help he can give with this issue. Using the java -jar command, this is the printout I get:
    Microsoft Windows [Version 6.0.6002]
    Copyright (c) 2006 Microsoft Corporation.  All rights reserved.
    C:\Users\vecdran>java -version
    java version "1.6.0_20"
    Java(TM) SE Runtime Environment (build 1.6.0_20-b02)
    Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
    C:\Users\vecdran>chdir C:\Games\Steam\Steamapps\common\Crysis\mods\mwll\actionma
    pper\dist
    C:\Games\Steam\steamapps\common\crysis\Mods\mwll\Actionmapper\dist>java -jar Act
    ionmapper.jar
    Jun 18, 2010 2:25:19 PM org.jdesktop.application.Application$1 run
    *SEVERE: Application class mwllactionmapper.MWLLActionmapperApp failed to launch*
    *java.lang.NullPointerException*
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFo
    lder(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
    s(Unknown Source)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
    n Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JFileChooser.updateUI(Unknown Source)
    at javax.swing.JFileChooser.setup(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLDocumentsFolder(Act
    ionmapsFileModel.java:141)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLProfiles(Actionmaps
    FileModel.java:160)
    at mwllactionmapper.MWLLActionmapperView.doSelectProfile(MWLLActionmappe
    rView.java:603)
    at mwllactionmapper.MWLLActionmapperView.<init>(MWLLActionmapperView.jav
    a:75)
    at mwllactionmapper.MWLLActionmapperApp.startup(MWLLActionmapperApp.java
    :21)
    at org.jdesktop.application.Application$1.run(Application.java:171)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Exception in thread "AWT-EventQueue-0" java.lang.Error: Application class mwllac
    tionmapper.MWLLActionmapperApp failed to launch
    at org.jdesktop.application.Application$1.run(Application.java:177)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Caused by: java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at sun.swing.WindowsPlacesBar.<init>(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.updateUseShellFo
    lder(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installComponent
    s(Unknown Source)
    at javax.swing.plaf.basic.BasicFileChooserUI.installUI(Unknown Source)
    at com.sun.java.swing.plaf.windows.WindowsFileChooserUI.installUI(Unknow
    n Source)
    at javax.swing.JComponent.setUI(Unknown Source)
    at javax.swing.JFileChooser.updateUI(Unknown Source)
    at javax.swing.JFileChooser.setup(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at javax.swing.JFileChooser.<init>(Unknown Source)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLDocumentsFolder(Act
    ionmapsFileModel.java:141)
    at mwllactionmapper.model.ActionmapsFileModel.getMWLLProfiles(Actionmaps
    FileModel.java:160)
    at mwllactionmapper.MWLLActionmapperView.doSelectProfile(MWLLActionmappe
    rView.java:603)
    at mwllactionmapper.MWLLActionmapperView.<init>(MWLLActionmapperView.jav
    a:75)
    at mwllactionmapper.MWLLActionmapperApp.startup(MWLLActionmapperApp.java
    :21)
    at org.jdesktop.application.Application$1.run(Application.java:171)
    ... 8 more
    C:\Games\Steam\steamapps\common\crysis\Mods\mwll\Actionmapper\dist>As you can see, my Java is completely up to date, and this is the only program I appear to have problems launching. I have no idea what to do from here. :(
    PS.
    I had to add the Java path to my System -> Environmental Variables -> Path variable, as it was not there from the start, and before adding it command prompt wouldn't recognize java commands. Don't know whether this indicates anything.
    Edited by: vecdran on Jun 20, 2010 11:23 AM

    [Bug ID 4711700|http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4711700] is eerily similar to what you're experiencing. Although the bug was reported against an older version of the JDK the last comment provides a workaround to the problem that may be helpful. Good luck.

  • How can I run my program on command line?

    I'm having some trouble trying to run my program on command line.
    I get a message saying "Exception in thread
    "main" java.lang.NoClassDefFoundError: Rectangle
    <a href="http://img145.imageshack.us/my.php?image=untitled2copylh2.jpg" target="_blank"><img src="http://img145.imageshack.us/img145/3002/untitled2copylh2.th.jpg" border="0" alt="Free Image Hosting at www.ImageShack.us" /></a>
    import java.util.Scanner;
    public class Rectangle
    public static void main(String[] args)
    int width;
    int height;
    int count = 1;
    Scanner scan = new Scanner (System.in);
    System.out.println("Please enter the width of the rectangle: ");
    width = scan.nextInt();
    System.out.println("Please enter the height of the rectangle: ");
    height = scan.nextInt();
    while (count <= width)
    if(width < 1 || width > 30)
    throw new IllegalArgumentException("The numbers must be in range");
    if(height < 1 || height > 30)
    throw new IllegalArgumentException("The numbers must be in range");
    for (int star = 1; star <= height; star++)
    System.out.print("*");
    System.out.println();
    count++;
    }

    What doesn't work?
    When you type javac Rectangle.java do you get error messages? Does it create the file Rectangle.class? If yes, type java Rectangle and your program should run. If you get an error post it but if you followed earlier advice you should be able to solve the problem yourself.

Maybe you are looking for

  • K8N Neo2-F hangs when installing Windows XP Pro

    Hello, I've recently been trying to put together my first build, and I haven't had too much luck thus far. My problem occurs when trying to clean install Windows XP Pro on my hard drives. Using either of my HDDs results in the Windows setup screen co

  • Change default page to Dashboards

    Hi, When i log in Presentation the first page that appears is Answers. How i change this to Dashboard? Thanks

  • Can't Access A Class

    Hello everyone...i have a program that's composed of a html,jsp and a .java page...i use bean....i have reversed engineer this system i got it is a forum site made of jsp and javabeans...my problem is that it can't reach the class from a .java file..

  • Ipad 2 broadband speed

    When I pick up my ipad 2 the broadband speed drops by half is it broken? I have good knowledge of routers and wifi in general and I don't have any problems with any of my other devices such as xbox laptop and even my first edition ipad works just fin

  • Since I switched to Mavericks, cannot print Jetblue boarding pass.

    I have not been able to print Jetblue boarding passes since I have switched to Mavericks.  When I hit the print button, it appears blank in the small printer window and will not print.