Basic (and I mean basic) java problem with a simple hello world script

I have a simple cut-and-paste html page and java class in my /home/jc158027/java directory.
jc158027> cat HelloWorld.java
import java.applet.*;
import java.awt.*;
public class HelloWorld extends Applet{
Label helloLabel = new Label ("Hello World");
public void init () {
  setBackground (Color.yellow);
  add (helloLabel);
}Ok, so I javac HelloWorld.java and get HelloWorld.class, so far so good.
Next I create my html page:
jc158027> cat hw.html
<HTML>
<HEAD>
<TITLE>Jay's Java Test Page</TITLE>
<BODY>
<HR>
This line of text comes before the applet.<P>
<APPLET CODE = 'HelloWorld.class" WIDTH=500 Height=90>
</APPLET>
<P>
This line of text comes after the applet.
</BODY>
</HTML>The result is that the text lines work, I get a nice grey box with no applet running. Looking at my console I get the following error:
Caused by: java.io.FileNotFoundException: /home/jc158027/java/HelloWorld/class".class (No such file or directory)
What I don't understand is the HelloWorld/class".class portion, shouldn't it be just either HelloWorld".class or HelloWorld/class, it is as though it is trying to look in a directory (class) that does not exist.
What am I missing here?

And if you put dots in where it expects a class name, it assumes those dots are to separate levels in a package name.
So it was looking for a class named "class", which would be in a file called class.class, in a package named "HelloWorld". Packages correspond to directories relative to some classpath root, so it looked for the directory HelloWorld to be the parent of the classes in the HelloWorld package.

Similar Messages

  • Problem with a simple hello world JSP

    We have just installed WLS Express 7.0 (just downloaded) on a Solaris 8 server. Using the dmwiz.sh, we have created a new domain with a managed server. Both the Admin Server and managed server have started and are running. When I tried to load a sample web application (a war file that has a hello world JSP), I got a HTTP 500 internal server error in serving the hello.jsp page. This sample works fine in Windows WLS Express 7.0.
    Can someone please help? Thank you in advance.

    Alex <[email protected]> wrote:
    We have just installed WLS Express 7.0 (just downloaded) on a Solaris
    8 server. Using the dmwiz.sh, we have created a new domain with a managed
    server. Both the Admin Server and managed server have started and are
    running. When I tried to load a sample web application (a war file
    that has a hello world JSP), I got a HTTP 500 internal server error
    in serving the hello.jsp page. This sample works fine in Windows WLS
    Express 7.0.
    Can someone please help? Thank you in advance.Hi,
    It seems the installation of the server worked fine as you were able to start
    the servers.
    You may try posting this message to the weblogic.developer.interest.jsp newsgroup.
    If you are
    not using the latest service pack, please try using that.
    regards,
    Platform Team
    BEA Systems

  • Problem running a simple Hello World RMI Program

    I wrote a simple RMI application, consisting of a Server Interface, Server Implementation and a Client.
    Since the codes are really small, am pasting them here so that you could identify the problem if any, in the code.
    1. Server Interface......
    import java.rmi.* ;
    public interface HelloInterface extends java.rmi.Remote
         public void sayHello(String arg) throws RemoteException ;
    2. Server Implementation......
    import java.rmi.* ;
    import java.rmi.server.* ;
    public class HelloImpl extends UnicastRemoteObject implements HelloInterface
         public HelloImpl() throws RemoteException
              super() ;
         public void sayHello(String arg) throws RemoteException{
              try{
                   System.out.println("RMI Program : Hello "+arg) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
         public static void main(String[] args) throws RemoteException
              try{
                   if( System.getSecurityManager() == null )
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloImpl impl = new HelloImpl() ;
                   Naming.bind("HelloService",impl) ;
                   System.out.println( "Service bound..." ) ;
              catch(Exception e){
                   e.printStackTrace() ;
                   //throw new java.rmi.UnexpectedException("undeclared checked exception", e);
    3. Client Code.
    import java.rmi.* ;
    import java.rmi.Naming.* ;
    class RMIClient
         public static void main(String[] args)
              try{
                   if(System.getSecurityManager()==null)
                        System.setSecurityManager( new RMISecurityManager() ) ;
                   HelloInterface helloInt = (HelloInterface) Naming.lookup("rmi://sand.cise.ufl.edu/HelloService") ;
                   helloInt.sayHello("Ranjit") ;
              catch(Exception e){
                   e.printStackTrace() ;
    I have double checked the classpaths and they all look fine..
    I have even unset the classpath from the shell which runs the rmiregistry..am still getting these errors..
    1. If i use the default java to run the application..this is the error that it spits..
    sand:24% java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:110)
    at HelloImpl.main(HelloImpl.java:28)
    Caused by: java.lang.ClassNotFoundException: HelloImpl_Stub
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:350)
    ... 3 more
    2. Using java from some other location..the error looks different...but in both cases it just gives errors :((
    sand:25% /usr/java1.2/bin/java -Djava.security.policy=java.policy HelloImpl
    java.rmi.UnexpectedException: undeclared checked exception; nested exception is:
    java.lang.ClassNotFoundException: HelloImpl_Stub
    java.lang.ClassNotFoundException: HelloImpl_Stub
    at java.lang.Throwable.fillInStackTrace(Native Method)
    at java.lang.Throwable.fillInStackTrace(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Compiled Code)
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:342)
    at sun.rmi.registry.RegistryImpl_Stub.bind(Unknown Source)
    at java.rmi.Naming.bind(Naming.java:116)
    at HelloImpl.main(HelloImpl.java:28)
    I am embarking on a huge assignment but if am having problems getting started..
    Your help will be highly appreciated..
    thanx and regards
    Ranjit Iyer

    First of all you should be posting this Q in the RMI forum :)
    You are getting that error because your stub is not in your clients classpath (or u can say the compiler is not able to find it).
    Make sure that the file HelloImpl_Stub is in the client classpath/package.
    Regards
    Meka Toka

  • I have a problem when using Google Maps, at some point my computer blanks the window and says there's a problem with display drivers, and it has recovered,but it doesn't. Problem doesn't happen with Int Explorrer, so I do not believe it is the computer

    When using google maps through Firefox, after asking for a place which is not the general North America section which routinely comes up, the firefox screen goes white, with a narrow banner at the top. A message appears in the lower right corner which says something about display drivers having had a problem, but now have recovered. However the display doesn't recover and the banner message is that Firefox is not responding. When I go to restart Firefox if I go to the restore point, the page is still frozen out.
    I do not believe it is a problem with my computer because it doesn't happen if I use I.E. to go to google maps, then G-maps works normally.
    This phenomenon did not happen before the latest upgrade to either Google or Firefox. I have used Fiefox for a number of years and also Google Maps on previous computers and on this one, and not had this before.
    This is a relatively young computer (Asus EeSlate 121) less than a year old. I have used Firefox since I bought it and until recently had no problem with Google Maps.

    I solved it myself, after the "note" which came back from FF/Mozilla just as I finished my message, commenting on what it was that my system had , I wnnt back to check my plug-ins etc. I downloaded the latest Java, BOTH 32bit AND 64 bit versions and latest Firefox.
    Now all is working.
    Thanks,
    B.

  • I have upgraded Apple Aperture from version 2 to version 3 and I'm having a problem with the "Highlights and Shadows" adjustment. According to the user's manual, I should have access to an advanced disclosure triangle which would allow me to adjust mid co

    I have upgraded Apple Aperture from version 2 to version 3 and I'm having a problem with the "Highlights and Shadows" adjustment. According to the user's manual, I should have access to an advanced disclosure triangle which would allow me to adjust mid contrast, colour, radius, high tonal width and low tonal width.
    If anyone has any suggestions as to how to access this advanced section, I'd be most grateful.

    Hi David-
    The advanced adjustments in the Highlights & Shadows tool were combined into the "Mid Contrast" slider in Aperture 3.3 and later. If you have any images in your library that were processed in a version of Aperture before 3.3, there will be an Upgrade button in the Highlights & Shadows tool in the upper right, and the controls you asked about under the Advanced section. Clicking the Upgrade button will re-render the photo using the new version of Highlights & Shadows, and the Advanced section will be replaced with the new Mid Contrast slider. With the new version from 3.3 you probably don't need the Advanced slider, but if you want to use the older version you can download it from this page:
    http://www.apertureexpert.com/tips/2012/6/12/reclaim-the-legacy-highlights-shado ws-adjustment-in-aperture.html

  • I am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    i am going to buy unlocked iphone 5.. i will be going to india nxt months and will stay there for a while... so my question is will i get warrenty in india.. and will there be any problem with using indian sims..?? thnx for the help..

    The warranty for the iPhone is not and has never been International.
    Warranty and support are ONLY valid in the country of origin.  The only exception is the EU where the entire EU is treated as one country.
    If the device will be used in India, buy it in India.
    An unlocked iPhone will work on any supported GSM carrier world wide.  The LTE portion of a US purchased, unlocked iPhone is unlikely to work outside North America as it does not support the appropriate bands used in other countries.

  • I have Windows 7 and just recently experienced a problem with itunes freezing up when I clicked on the "apps" tab.  Everything else seems to work okay in itunes.  I have uninstalled it and reloaded it 4 or 5 times, but still freezes up.

    I have Windows 7 and just recently experienced a problem with itunes freezing up when I clicked on the "apps" tab which shows the apps that are loaded on my phone.  Everything else in the itunes software seems to be working okay.  The problem is in the part where you sync the newly purchased apps.  The apps will all be blank that are downloaded and that part of the software crashes itunes or freezes up.  I can get out of itunes okay after the freeze up, but it just stops me from syncing anything that I have newly added.  If anyone has had this problem before or knows someone that has, please let me know how I can fix it.  I have uninstalled and reloaded itunes 4 or 5 times, but the problem is still there.  I might add that I have been using itunes and purchasing apps for 2 to 3 years without any problems.  HELP.

    You would get better response from the iTunes community forum.
    Have a nice day!

  • Hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    hi, i have a macbook air and i've been having problems with the camera when i'm using skype. i know im no the 1st one and i'd like to know when apple or someone 'll do something about this.

    Try reinstalling Combo Update.
    http://support.apple.com/kb/DL1676
    Best.

  • Both xp and windows 7 have video problems with my VGA connection using TV

    both xp and windows 7 have video problems with my VGA connection using TV as my monitor when it gets to starting up windows no matter what version it will not I have let my mac on all night and still says starting windows or the windows 7 logo and nothing else will happen also when I use a 3rd patty software like peraills or other it works like a charm how to fix it?

    To map the drive on your computer click on Start - RUN - type "\\192.168.1.1" and click ok... When prompted for Username and Password type "admin" and click ok... Now you will be able to see the folder which you have shared on  your router, right click on it and select "Map network drive" and click on finish.
    Now it will map the drive on your computer and you should be able to transfer the file from your computer to the USB drive.

  • Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    Just installed Lion and the Magic TrackPad and I am having a problem with one click commands.  I have to hit the pad fairly hard with one finger to get it to accept the command.  Is this normal, is there another way that I am suppose to execute commands?

    No you just need to turn on Tap to Click. Go into System Preferences - Trackpad and click the Point to Click tab and select the first box which will say Tap to Click and you should be in business.

  • Hi! I just bought Lion and I am having a problem with the installation. It keeps telling me that the computer's hard drive has a S.M.A.R.T. problem. How can I solve it?problem.

    Hi! I just bought Lion and I am having a problem with the installation. It keeps telling me that the computer's hard drive has a S.M.A.R.T. problem. How can I solve it?
    Thanks!
    Angela

    You may have a hard drive problem. When I installed Lion, the installer told me that it couldn't complete because the hard drive was failing (or broken, the exact words escape me). Since the HD had been functioning just fine, I took it to the Genius Bar, and found out that yes, the hard drive was slowly dying (bad sectors). I couldn't reboot into Snow Leopard, the installer wouldn't let me and then the drive just wouldn't work at all.
    I had to replace my drive and restore from Time Machine. Thankfully, I had Time Machine, and had just done a backup 5 minutes before the crash.
    Best of luck.

  • Hi , I have an iPhone 5S and I have got a problem with the app store : iI can't update my apps  , it is asking me to change frim the UK store to go to the french one , but i have already changed it and I am in the French one !! Help ! :(

    Hi , I have an iPhone 5S and I have got a problem with the app store : iI can't update my apps  , it is asking me to change frim the UK store to go to the french one , but i have already changed it and I am in the French one !! Help !

    Have you tried signing out of your iTunes & App Store on your device and then back in again - Settings>iTunes & App Store, click on Apple ID, then on Sign Out. Then sign in again and see if it accepts the password.
    If that doesn't resolve the issue,  try resetting your device (nothing will be lost): Hold down the Home and Power buttons at the same time and continue to hold them down until the Apple appears (up to 30 seconds). Once the reset is complete, the Slide to Unlock screen will display. See if the problem is resolved.
    Cheers,
    GB

  • Anyone know why my itunes says I need to re-install and that it's having problems with Microsoft Visual C

    Anyone know why my itunes says I need to re-install and that it's having problems with Microsoft Visual C++?

    See... Unable to install or open > http://support.apple.com/kb/TS5376
    Also See this User Tip by turingtest2
    https://discussions.apple.com/docs/DOC-6562
    littlered1382 wrote:
      I am also concerned that I will lose all of the things that I have backed up from my phones, purchases, apps, etc.
    It has always been Prudent to Create and Maintain a Backup of anything you would not like to lose.

  • I have migrated from London to New Delhi and i am facing some problem with my iPhone 4s and i am not able to setup a repair .My phone is in under warranty too. Can anyone tell whats the matter?

    I have migrated from London to New Delhi and i am facing some problem with my iPhone 4s and i am not able to setup a repair .My phone is in under warranty too. Can anyone tell whats the matter?

    The warranty is NOT international. You must take it back to the country of origin if it needs repair. The E.U. is considered a single country for warranty purposes.

  • I installed Lion and now seem to have problems with Microsoft Silverlight and other plug ins and applications.  I haven't ever used time machine to back up (my bad I know).  Is there a way to go back to snow leopard with messing up all my files and my set

    I installed Lion and now seem to have problems with Microsoft Silverlight and other plug ins and applications.  I haven't ever used time machine to back up (my bad I know).  Is there a way to go back to snow leopard with messing up all my files and my set?

    Are you using the latest version of Silverkeeper? - v.2.0.2 is stated to be compatible with Snow Leopard.
    http://www.lacie.com/silverkeeper/
    If it's messing things up you could try asking LaCie Support for assistance.

Maybe you are looking for