• Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding Java to a Website

 
Erer erer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am having trouble adding a java application to a webpage. Can I get some help?

I used

<APPLET CODE="Project1.class" HEIGHT=500 WIDTH=500></APPLET>

to load it to the page, but I keep getting when on the page.

ClassFormatError

Incompatible magic value 791627122 in class file Project1
 
Paul Clapham
Sheriff
Posts: 21973
36
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That means that when the applet's container (i.e. the browser) asks for Project1.class from the server, the server gives it something which isn't a Java class.

Let's find out what: the first 4 bytes of it are 791627122 as a decimal number. As a hexadecimal number (get out your calculator which does the conversion) it's 2F2F4572. And converting to characters, that's "//%H".

So whatever your server is returning, it isn't a Java class. It's some kind of text, maybe an error page or something, which starts with "//%H". Check and repair your server configuration.
 
Erer erer
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Javascript runs fine in Netbeans

and im sure not how to perform the function you specified in your post
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!