2

I am a beginner programmer with some experience in HTML, PHP, and Java. I would like to upload a chessboard onto my website, and I have used the following links to help me:

http://chess.geniusprophecy.com/chess-viewer.html

http://chesstuff.blogspot.com/2008/11/chess-viewer-deluxe.html

However, I am getting stuck in placing the code (in steps 2. and 3. of the second link) in my source code. For example, what lines should I change and manipulate in

<APPLET archive="Viewer-Deluxe.jar" code="ChessBoard.class"
codebase="/bin" width="631" height="560" mayscript="true">
<PARAM name=PgnGameFile value="/games/Samples.Pgn">
<PARAM name=LightSquares value=F3DCC2>
<PARAM name=DarkSquares value=DDA37B>
<PARAM name=Background value=CCCCCC>
<PARAM name=ImagesFolder value=images>
<PARAM name=PuzzleMode value="off">
Your browser is completely ignoring the &lt;APPLET&gt; tag!
</APPLET>

in order for my code to work? I've tried modifying the value="" line many many times and I'm frustrated because nothing seems to be working. I've saved my files in the right directory, subdirectory, etc. but I keep getting the error

java.io.FileNotFoundException

Screenshot of step at which I am stuck

  • Does that "downloading" progress bar say "5 KB of 324 KB"? When it completes I'd expect the applet to run. – Tony Ennis Jul 16 '13 at 11:20
1

Your issue is likely because you're running Windows instead of *nix.

<PARAM name=PgnGameFile value="/games/Samples.Pgn">

/games/Samples.Pgn is a unixy way to specify a path. If you're on Windows, try the similar:

c:\games\Samples.pgn

Be sure you get the spelling and capitalization exactly right.

Edit #1

According to the feedback below, there's now a malformed URL exception. So the value needs to be a URL, not a file name. That's a little different - the unix-like path is correct.

First, try games/Samples.pgn

Note there is no leading /.

Make sure the capitalization is exactly right. This assumes that there's a folder under your web root called games and that your web server has access to it. The original URL, /games/Samples.Pgn, would likely require a folder called games to be hanging off the root of the hard drive and most web servers don't have access to that folder.

| improve this answer | |
  • Thanks Tony, but now I'm getting the error: java.net.MalformedURLException: unknown protocol: c – user1478 Jul 15 '13 at 22:50
  • answer edited... – Tony Ennis Jul 15 '13 at 23:39
  • My question now is how do I download all the games off of one folder (games) instead of having to do so individually? (I'm talking about within the chess viewer applet - it would be easier if you looked at my website.) – user1478 Jul 16 '13 at 3:10
  • I typed in value="Abhishek Mallela/games/Smith.pgn" because I have an Abhishek Mallela folder and a games subfolder and a Smith.pgn game within that subfolder. Now, it is saying "Downloading... PGN File: Abhishek Mallela/games/Smith.pgn". This seems like an error to me, because it hasn't 'downloaded' for a long time – user1478 Jul 16 '13 at 3:19
  • When I put just value="games/Smith.pgn", I get Java.io.FileNotFoundException. – user1478 Jul 16 '13 at 3:20
1

I'm not too familiar with the Java applets that you're looking at, but I recommend that you use JavaScript for this sort of job. This GitHub repository can be used to display and play through your own games (it supports PGN and FEN).

There are many other libraries out there - it's easy for you to change the design of the board and pieces to suit your site's style. You also might want to ask this question on StackOverflow as you might find some more technical advice there.

| improve this answer | |
  • Thanks, I asked on stackoverflow but no one has replied. I will definitely look at GitHub repository. – user1478 Jul 15 '13 at 21:28
  • The one I linked you to should be very easy to implement. Once you import the appropriate files, you can simply copy and paste the PGN into your webpage. – Andrew Ng Jul 15 '13 at 21:37
  • Sorry, I'm getting stuck. I downloaded the ZIP on the right hand side of your link, and then copied and pasted the source code of index.html (example page) into my code. But the chessboard is not showing up on my website abhishek.mallela.net. What am I doing wrong? – user1478 Jul 15 '13 at 23:10
  • 1
    Wait - you can't just paste the index.html file into your page. Import the appropriate JavaScript libraries (jQuery and jchess) into your own index.html file and use the template that they've provided. – Andrew Ng Jul 16 '13 at 1:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy