Welcome to the JaguarPC Community
JaguarPC
Sales: (888) 338-5261
Support: (888)-551-3050
Results 1 to 4 of 4

This is a discussion on Should be simple Java question in the Open Discussion & Chit-chat forum
I normally don't do Java but I want to do some stuff I can't do with Javascript or PHP. For testing I am trying to ...

  1. #1
    Aletia Refugee lvzardoz's Avatar
    Join Date
    Feb 2002
    Location
    Las Vegas
    Posts
    165

    Should be simple Java question

    I normally don't do Java but I want to do some stuff I can't do with Javascript or PHP.

    For testing I am trying to execute the simplest Java program:

    import java.io.*;

    class simple
    { public static void main(String[] args)
    { System.out.println("What the hell is the problem.");
    } }

    From a telnet (SSH) connection it runs fine on the command line.

    However, when I try to run it as an applet in a browser, the normal gray applet area displays but nothing else. When I move my cursor over the applet area it says that "simple.class" file (chmod'ed to 777 just in case) can't be found. Why? It resides in the same directory as the HTML file:

    <HTML>
    <BODY>
    Before applet<P>
    <applet code="simple.class" WIDTH=600 HEIGHT=300>
    </applet><P>
    After applet
    </BODY>
    </HTML>

    Bob from Las Vegas

  2. #2
    JPC Addict hobbes747's Avatar
    Join Date
    Nov 2002
    Location
    At the computer, duh!
    Posts
    201
    Wow, that 3 times I've seen this.

  3. #3
    Chairman Still Shady's Avatar
    Join Date
    Sep 2001
    Location
    Redmond, WA-nnabe
    Posts
    1,184
    OK... that class is not an applet so you can't run it on your browser.

    it should be something like:

    public class myClass extends Applet {
    public static void init() {
    System.out.println("hey...");
    }
    }

    so on

    compile it to a class and make sure you import the applet class, also an applet class must be public!
    Where do you wanna go today?

  4. #4
    Display Error
    Join Date
    Dec 2001
    Posts
    6
    I'm not too keen on applets (although I do program in Java), but I think System.out.println() prints to the console when in "applet mode". So open the console to see your output.
    Pixl Labs - YOU CANNOT DECIPHER THE CODE
    http://www.plzproductions.net/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •