Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner's Applet program

 
Vidur Koushik
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello everyone.. i have just started learning java..
i have written a small code for an applet..
i am trying it to embed in a webpage but ... somehow i am not able to do that..

here's the code i have written in java...


and here's the html code that i have written..

..
please help me....
thank you in advance...
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome!

What exactly is it doing?

WP
 
Vidur Koushik
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is just printing the text
"hello java".
 
Tim Moores
Bartender
Posts: 2792
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, that's all the code does. What else did you expect to happen?
 
Vidur Koushik
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
no..what i mean is..
the browser is not showing the applet...
it's just saying that there is an error..
and the error message displayed is ...


Java Plug-in 1.6.0_31
Using JRE version 1.6.0_31-b05 Java HotSpot(TM) Client VM
User home directory = C:\Users\n
----------------------------------------------------
c: clear console window
f: finalize objects on finalization queue
g: garbage collect
h: display this help message
l: dump classloader list
m: print memory usage
o: trigger logging
q: hide console
r: reload policy configuration
s: dump system and deployment properties
t: dump thread list
v: dump thread stack
x: clear classloader cache
0-5: set trace level to <n>
----------------------------------------------------


java.lang.UnsupportedClassVersionError: hellojava : Unsupported major.minor version 51.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
at sun.plugin2.applet.Plugin2Manager.createApplet(Unknown Source)
at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Exception: java.lang.UnsupportedClassVersionError: hellojava : Unsupported major.minor version 51.0
 
Tim Moores
Bartender
Posts: 2792
38
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You used Java 7 to compile this class, but your browser runs with Java 6 - that doesn't work. Your options are a) compile your code with Java 6, b) configure your browser to use Java 7, or c) compile your sources with the "-source 1.6 -target 1.6" options. (c) is probably the worst, as you'd need to take care not to use any new Java 7 features (because those don't work on Java 6.)
 
Vidur Koushik
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i configure my browser to use java 7..??
 
Vidur Koushik
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well.. i found this link..where i was able to compile my .java file using java 6..
and it worked..

http://www.innovation.ch/java/java_compile.html

thank you Tom Moores..for helping me out..
i was looking for a solution since the last 6 hours..
and finally found it..thanks..again..
 
Maneesh Godbole
Saloon Keeper
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
kazi Shahin,
Your post was moved to a new topic.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic