Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Java Programming 24-Hour Trainer by Yakov Fain
This is the forum to discuss the Wrox book Java Programming 24-Hour Trainer by Yakov Fain; ISBN: 978-0-470-88964-0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Java Programming 24-Hour Trainer by Yakov Fain section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old February 21st, 2012, 10:49 PM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson10

Hello All,

When I run my applet I get the text that I place in paint. However when I run the code below in a browser, I do not get anything but a blank white screen. I have my html file under the JRE System Library and my .java class in a default package. I am unable to run a simple applet in a browser. Thanks in Advance!

HTML Code:
<html>

<head>

<title>My First Web Page</title>

</head>

<body>
My Tic-Tac-Toe game is coming soon:
<APPLET code="HelloWorld.class" width="300" height="250" />
</body>

</html>
  #2 (permalink)  
Old February 22nd, 2012, 08:53 AM
Authorized User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Location: uk
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default Re:Lesson10

Hi Luthios

Move your html file into the same location as your java class. The html code is looking for your java class in JRE System Library and that is not the location of your class.

You could also place you html code in the Lesson 10 folder and use the following in your html file replace the APPLET code with your class information.

Code:
<APPLET code="com.practicaljava.lesson11.TicTacToeApplet" codebase="./bin" width=350" height="400" />
The code is basically saying that the applet code is at com/practicaljava/lesson11/TicTacToeApplet.class and the place to look is /bin.

hope this helps
  #3 (permalink)  
Old February 22nd, 2012, 10:47 AM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks Wolverine. I tried the suggestion and got the same results. If I navigate to the file path I get a box with a red x in the browser.
  #4 (permalink)  
Old February 22nd, 2012, 12:32 PM
Authorized User
Points: 159, Level: 3
Points: 159, Level: 3 Points: 159, Level: 3 Points: 159, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Location: Romania
Posts: 30
Thanks: 5
Thanked 4 Times in 4 Posts
Default

Hello Luthios,
I think you will run successfully the applet in a browser if you locate HelloWorld.class and move it in the same directory as your html file. HelloWorld.class is created by Eclipse from your HelloWorld.java, probably when you first run HelloWorld.java as Java Applet. In my case, I found it in the bin directory of my project path.
Hope this helps.
  #5 (permalink)  
Old February 22nd, 2012, 02:38 PM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Unfortunatley, it is in the same folder as the class and will not run.
  #6 (permalink)  
Old February 22nd, 2012, 02:50 PM
Authorized User
Points: 159, Level: 3
Points: 159, Level: 3 Points: 159, Level: 3 Points: 159, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Feb 2012
Location: Romania
Posts: 30
Thanks: 5
Thanked 4 Times in 4 Posts
Default

I guess this is a proof that distance learning cannot always replace successfully in-class, instructor lead training.
Sorry I coulnd't help...
  #7 (permalink)  
Old February 22nd, 2012, 03:30 PM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Your help is greatly apreciated! I am also checking other forums and when I find the answer I will post it here. I think there is something anal I am overlooking.
  #8 (permalink)  
Old February 22nd, 2012, 04:14 PM
Authorized User
Points: 30, Level: 1
Points: 30, Level: 1 Points: 30, Level: 1 Points: 30, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Sep 2011
Location: uk
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Luthios

your browser is blocking the running of scripts or Active X controls?
  #9 (permalink)  
Old February 22nd, 2012, 06:43 PM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I have internet explorer 9 set to allow activex. If i did have them blocked IE9 will prompt me to allow blocked content. I tried in chrome as well and I still getting the same results.
  #10 (permalink)  
Old February 22nd, 2012, 06:58 PM
Authorized User
Points: 71, Level: 1
Points: 71, Level: 1 Points: 71, Level: 1 Points: 71, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2012
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default ERROR: From Applet

Below is the error message that I am receiving when running the applet.

Quote:
Java Plug-in 10.1.0.8
Using JRE version 1.7.0_01-b08 Java HotSpot(TM) 64-Bit Server VM
User home directory = C:\Users\MyDirectory
----------------------------------------------------
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>
----------------------------------------------------
Detected from bootclasspath: C:\\PROGRA~1\\Java\\jre7\\lib\\deploy.jar








Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.