Embedding a Java Prog in a web site

Dear All

I'm having a little trouble getting a Java prog to work online.

I am using the following code to embed it:

<applet

code=["WebApp"]

width=[100] height=[100]

alt=["Description of Java applet"]>

</applet>

However in the Java consule I get the following error message -

Laden: Klasse ["WebApp"] nicht gefunden

java.lang.ClassNotFoundException: ["WebApp"]

at sun.applet.AppletClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: sun.net.ftp.FtpLoginException: Not logged in

at sun.net.ftp.FtpClient.readReply(Unknown Source)

at sun.net.ftp.FtpClient.issueCommand(Unknown Source)

at sun.net.ftp.FtpClient.login(Unknown Source)

at sun.net.www.protocol.ftp.FtpURLConnection.connect(Unknown Source)

at sun.net.www.protocol.ftp.FtpURLConnection.getInputStream(Unknown Source)

at sun.applet.AppletClassLoader.getBytes(Unknown Source)

at sun.applet.AppletClassLoader.access$100(Unknown Source)

at sun.applet.AppletClassLoader$1.run(Unknown Source)

at java.security.AccessController.doPrivileged(Native Method)

... 10 more

I assume this means that I have not made the class "WebApp" - first line of the message.

I realise now that my "WebApp" has the extension .Java - should it be .class?

Within the file "WebApp.java" I have the lines (I changed it from Main after seeing that the java consule was looking for the "class" WebApp) -

publicclass WebAppextends JApplet{//Main

public WebApp(){}//Main

publicstaticvoid webapp (String[] args)throws IOException//main

{..........

Thanks in advance.

Dan

[2738 byte] By [DanielFoorda] at [2007-11-27 3:56:29]
# 1
> I realise now that my "WebApp" has the extension> .Java - should it be .class?> From your posting record I see that you have been using Java for maybe a year now.May I ask politely , just what the f uck have you been doing all that time?
ScarletPimpernela at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 2
You can take a look at the applet tutorial. http://java.sun.com/docs/books/tutorial/deployment/applet/applettag.html
Caspera at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 3
Those square brackets - [] - look a bit out of place. Have a look at Sun's Tutorial which describes how to use the applet tag with examples http://java.sun.com/docs/books/tutorial/deployment/applet/html.html
pbrockway2a at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 4
Is this a joke?
-Kayaman-a at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 5

> Is this a joke?

I was wondering early on if some IDE had generated this, square brackets and all.

Along these lines I also think it would be a very good idea NetBeans were altered so that instead of producing method signatures like:jSomeAbsurdlyLongComponentName42_WithEquallyLongHander(java.lang.etc...

it used obscenities instead for method names. The idea being to induce the user to change them into something reasonable.

pbrockway2a at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 6
Either that or the OP nabbed pseudo-code off another forum and placed it in his java program, fully expecting it to work exactly as he wants it to.
maple_shafta at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 7

> Either that or the OP nabbed pseudo-code off another

> forum and placed it in his java program, fully

> expecting it to work exactly as he wants it to.

Hai mapleshaft,

plz tel me were on teh inarnet i cn downlod teh compilar for teh pseudocodez.

plz this is Ugrent

ScarletPimpernela at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 8
> Hai mapleshaft,> > plz tel me were on teh inarnet i cn downlod teh> compilar for teh pseudocodez.> > plz this is UgrentGood lord, man! You must stop "reading" Ok! magazine! It is making your "brain" softer than orange
filestreama at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 9

ScarletPimpernel, here's a few of the things I've been doing:

... not running Applets on a website but just on my computer at home(non web application).

running code OK until trying to embed.

changing nappies

Taking code from other tutorials and seeing if it works how I want it to.

going mountain biking.

sometimes reading Java for Dummies.

watching a bit of TV

playing guitar.

reading these boards every-so-often to see if things help.

using NetBeans which generates lots of default file names which I haven't changed

Growing tomatoes

Not doing any Java for about 3-4 months,

working (not in the IT industry).

Is that enough for you?

Have no fear, I am not some uni student who has left their project till the last minute. This is not urgent and I am doing this as a bit of a freetime/"fun thing.

Message was edited by:

DanielFoord

DanielFoorda at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...
# 10

Surprising as it maybe I haven't nicked the code in my application from anyone.

Having realised my mistake (had uploaded the .java files to the net and not the .class (compiled java files) and looked at one of the links given) I get as far as my website

saying "download plugin". However, Firefox can't find the plug in - "type="application/x-java-applet;jpi-version=1.6".

Now because I nicked the code from a tutorial and that line is in the HTML code, I'm not exactly sure what it means(I've changed the Applet names to match my application):

<object classid="clsid:CAFEEFAC-0016-0000-0000-ABCDEFFEDCBA"

><param name="code" value="Applet1.class">

<comment>

<embed code="Applet1.class"

type="application/x-java-applet;jpi-version=1.6">

<noembed>

No Java Support.

</noembed>

</embed>

</comment>

</object>

Could anyone give me a pointer on what thr "type"line in the HTML is all about, why did the tutorial use those values? I know it's telling me the type of applet I am embedding but why does it screw up downloading my applet? Why can't Firefox find this plug in?

The tutorial doesn't really say too much about it (other than Firefox reads the embed tags).

Ta for you time.

Dan

DanielFoorda at 2007-7-12 9:00:42 > top of Java-index,Java Essentials,New To Java...