Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #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>
Reply With Quote
  #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
Reply With Quote
  #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.
Reply With Quote
  #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.
Reply With Quote
  #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.
Reply With Quote
  #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...
Reply With Quote
  #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.
Reply With Quote
  #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?
Reply With Quote
  #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.
Reply With Quote
  #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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 06:40 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.