Java Applet in another directory

Reply

Join Date: Dec 2008
Posts: 3
Reputation: BobTheFish is an unknown quantity at this point 
Solved Threads: 0
BobTheFish BobTheFish is offline Offline
Newbie Poster

Java Applet in another directory

 
0
  #1
Dec 26th, 2008
My applet runs fine when it's in the same directory as the html, but when I put it in another directory, Java console says it can't find the file.
When I copy-paste into my browser the address I'm specifying for 'code' in my applet tag, it finds the file without problems.

Thanks.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Java Applet in another directory

 
0
  #2
Dec 26th, 2008
Paste the code of the HTML file which is using your Applet, So we can see whats going on.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: BobTheFish is an unknown quantity at this point 
Solved Threads: 0
BobTheFish BobTheFish is offline Offline
Newbie Poster

Re: Java Applet in another directory

 
0
  #3
Dec 26th, 2008
This works fine:
  1. <applet width=450 height=300 code="applet_maxr.class">

This doesn't:
  1. <applet width=450 height=300 code="http://.../applet_maxr.class">
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 1,175
Reputation: stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light stephen84s is a glorious beacon of light 
Solved Threads: 125
Featured Poster
stephen84s's Avatar
stephen84s stephen84s is offline Offline
Veteran Poster

Re: Java Applet in another directory

 
0
  #4
Dec 27th, 2008
Sorry for the delayed reply, but I would like to point out that the "code" attribute of the "<applet>" tag can only take a relative URL and not an absolute one.

To be able to use the applet mentioned in the URL, you will need to use the "codebase" attribute of the "<applet>" tag, shown below:-

  1. <applet width=450 height=300 codebase="http://.../" code="applet_maxr.class">

You can learn more about them here.
Last edited by stephen84s; Dec 27th, 2008 at 5:35 am.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand."

"How to ask questions the smart way ?"
Reply With Quote Quick reply to this message  
Join Date: Dec 2008
Posts: 3
Reputation: BobTheFish is an unknown quantity at this point 
Solved Threads: 0
BobTheFish BobTheFish is offline Offline
Newbie Poster

Re: Java Applet in another directory

 
0
  #5
Dec 27th, 2008
Thanks!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC