aspose file tools*
The moose likes Applets and the fly likes Beginner's Applet program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "Beginner Watch "Beginner New topic
Author

Beginner's Applet program

narendra vuppuluri
Greenhorn

Joined: May 07, 2012
Posts: 9
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

Joined: Mar 28, 2012
Posts: 859

Welcome!

What exactly is it doing?

WP
narendra vuppuluri
Greenhorn

Joined: May 07, 2012
Posts: 9
it is just printing the text
"hello java".
Tim Moores
Rancher

Joined: Sep 21, 2011
Posts: 2408
Well, that's all the code does. What else did you expect to happen?
narendra vuppuluri
Greenhorn

Joined: May 07, 2012
Posts: 9
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
Rancher

Joined: Sep 21, 2011
Posts: 2408
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.)
narendra vuppuluri
Greenhorn

Joined: May 07, 2012
Posts: 9
how can i configure my browser to use java 7..??
narendra vuppuluri
Greenhorn

Joined: May 07, 2012
Posts: 9
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

Joined: Jul 26, 2007
Posts: 10451
    
    8

kazi Shahin,
Your post was moved to a new topic.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Beginner's Applet program