Java

Forum for alternative clients, mods & discussions on the same.

Moderator: Phades

Java

Postby danvath » Wed Mar 21, 2012 4:45 pm

I am currently trying to get into Java programming, and I understand (for the most part) the mechanics of it but I am running into trouble when I try to do a simple hello world.
I have the .html set up, and I was able to go through dos to get the class file made using javac (using JDK 1.7.0_01) but when I open the html it says the title but when it gets to the <applet> </applet> and trys to read that file it says Error click here for details, but it locks up my explorer.

import java.applet.*;
import java.awt.*;

public class HelloWorld extends Applet
{
public void paint (Graphics g)
{
g.drawString("Hello World!", 50, 25);
}
}

is the .java file

HTML file


<HTML>

<HEAD>
<TITLE>Hello World Applet</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Hello World Applet</H1>
<APPLET CODE="HelloWorld.class" WIDTH=150 HEIGHT=25></APPLET>
</BODY>
</HTML>

anyone see anything that may cause this?
danvath
 
Posts: 84
Joined: Fri Nov 26, 2010 2:05 am

Re: Java

Postby jock » Sat Mar 24, 2012 5:43 am

CODE has to be small letters from what i read on the wiki.

<P>Here it is: <APPLET code="HelloWorld.class" WIDTH="200" HEIGHT="40">
This is where HelloWorld.class runs.</APPLET></P>
jock
 
Posts: 693
Joined: Thu Mar 08, 2012 7:27 am

Re: Java

Postby MightySheep » Sat Mar 24, 2012 6:57 am

I dont know anything about using Java for the web but one thing that did catch my attention is "HelloWorld.class", shouldn't it be "HelloWorld.java" ?
User avatar
MightySheep
 
Posts: 2151
Joined: Fri Jul 22, 2011 1:18 pm

Re: Java

Postby TheTylerLee » Sat Mar 24, 2012 7:00 am

if its the script name it should be .java



also if you need help scripting try this site


www.rsbuddy.com


its a Runescape botting site, thats how i learned to script ;p

its slightly different though, but those bots are more advanced ;p
Discord: XiliX#2791
User avatar
TheTylerLee
 
Posts: 1604
Joined: Thu Jul 21, 2011 6:00 am

Re: Java

Postby Leny-m » Sat Mar 24, 2012 10:15 am

TheTylerLee wrote:if it's the "script" name it should be .java


Minor java errors should stay between you and Google btw.
Image Image Image Image Image
Leny
User avatar
Leny-m
 
Posts: 109
Joined: Sat Dec 17, 2011 8:04 pm

Re: Java

Postby TheTylerLee » Sat Mar 24, 2012 10:17 am

Leny-m wrote:
TheTylerLee wrote:if it's the "script" name it should be .java


Minor java errors should stay between you and Google btw.


why u quote me
Discord: XiliX#2791
User avatar
TheTylerLee
 
Posts: 1604
Joined: Thu Jul 21, 2011 6:00 am

Re: Java

Postby Leny-m » Sat Mar 24, 2012 10:32 am

The quote is the answer to the OP.

The second line is advice to the OP.

Sorry for the inconvenience ;)
Image Image Image Image Image
Leny
User avatar
Leny-m
 
Posts: 109
Joined: Sat Dec 17, 2011 8:04 pm


Return to The Wizards' Tower

Who is online

Users browsing this forum: No registered users and 4 guests