Home > Archive > Java Help > March 2004 > Can't compile a java file.
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Can't compile a java file.
|
|
|
| Hello!
I'm completely new to java, so please bear with me. I've tried to work
on a source code file for an applet where the source code is completely
free, however I can't get it to compile. Even the provided source code
will not compile on my machine (windows xp) without ~41 errors..
The original source code is available here->
http://mychess.com/source/MyChessViewer/
I've tried modifying the chessboard.java, however I can't get anything
to compile without errors. could someone help me?
I'm on a Windows XP machine with standard java sdk 1.4.2-04 installed.
Thanks,
Mark
| |
|
|
|
| Andrew Thompson wrote:
>On Sun, 28 Mar 2004 21:21:18 -0500, Mark wrote:
>
>
>
>
>Those 3 files (I would say you need
>them all to make anything work) come
>to 140Kb!
>
>It is best to start with codes that
>are small and self contained, until
>you have got your environment set up,
>understand how to read stack traces,
>and launch/compile from the command line.
>
>For (some) suitable small examples, check here..
><http://www.physci.org/launcher.jsp>
>
>
Yes, I know it's a lot of code for a newbie, however I"m not a complete
novice (I play with php/mysql/VB) and I'm only interested in fixing a
small bug in this applet. I am even relatively sure what the problem is,
but I can't test my theories if I can't get it to compile.
Mark
| |
| Tony Morris 2004-03-29, 7:35 am |
|
> I am even relatively sure what the problem is,
> but I can't test my theories if I can't get it to compile.
<cynic>
LOL!
</cynic>
| |
| Sanjay Goel 2004-03-29, 8:36 am |
| Mark wrote:
> Hello!
>
> I'm completely new to java, so please bear with me. I've tried to work
> on a source code file for an applet where the source code is
> completely free, however I can't get it to compile. Even the provided
> source code will not compile on my machine (windows xp) without ~41
> errors..
>
> The original source code is available here->
>
> http://mychess.com/source/MyChessViewer/
>
> I've tried modifying the chessboard.java, however I can't get anything
> to compile without errors. could someone help me?
>
> I'm on a Windows XP machine with standard java sdk 1.4.2-04 installed.
>
> Thanks,
>
> Mark
I dont know which version of Sun JVM used to support such code. There are
some basic compilation check errors in these classes.
In ChessBoard.java, there is a problem with the imports. It is using List
class which is available both as java.awt.List and java.util.List.
Add this line import java.awt.List on the top to explicitly use this class.
In ChessScoreKeeper.java, there are a few lines which ends with ;; ....
there should be just one semicolon at the end of the statement.
do these 2 steps and the code will compile.
Sanjay
| |
|
| Sanjay Goel wrote:
>Mark wrote:
>
>
>
>I dont know which version of Sun JVM used to support such code. There are
>some basic compilation check errors in these classes.
>In ChessBoard.java, there is a problem with the imports. It is using List
>class which is available both as java.awt.List and java.util.List.
>Add this line import java.awt.List on the top to explicitly use this class.
>In ChessScoreKeeper.java, there are a few lines which ends with ;; ....
>there should be just one semicolon at the end of the statement.
>do these 2 steps and the code will compile.
>Sanjay
>
>
Thank you!!
I now have the following at the beginning of chessboard.java (added the
first line)
import java.awt.List
import java.awt.*;
import java.applet.Applet;
import java.awt.event.*;
import java.awt.image.*;
import java.net.*;
import java.io.*;
import java.util.*;
import java.util.zip.*;
I now only get 1 error, which says:
chessboard.java:11: ';' expected
import java.awt.*;
I've tried putting ;'s all over the place and it only gets worse...
a side question: is 11 the line of code that the error occurs in?
import.java.awt.*; is line 11.
Any suggestions?
Thanks again!
Mark
>
>
>
| |
| Christophe Vanfleteren 2004-03-29, 9:39 pm |
| Mark wrote:
> I now have the following at the beginning of chessboard.java (added the
> first line)
>
> import java.awt.List
> import java.awt.*;
> import java.applet.Applet;
> import java.awt.event.*;
> import java.awt.image.*;
> import java.net.*;
> import java.io.*;
> import java.util.*;
> import java.util.zip.*;
>
> I now only get 1 error, which says:
>
> chessboard.java:11: ';' expected
> import java.awt.*;
>
> I've tried putting ;'s all over the place and it only gets worse...
>
> a side question: is 11 the line of code that the error occurs in?
> import.java.awt.*; is line 11.
>
> Any suggestions?
You forgot to add the ; after the first line.
And sometimes, if the compiler says something is wrong with line n, and you
don't see anything wrong with it, you should look at line n-1, as was the
case here.
--
Kind regards,
Christophe Vanfleteren
| |
| Andrew Thompson 2004-03-29, 9:39 pm |
| On Mon, 29 Mar 2004 20:21:03 -0500, Mark wrote:
> I now have the following at the beginning of chessboard.java (added the
> first line)
>
> import java.awt.List
> import java.awt.*;
....
> I now only get 1 error, which says:
>
> chessboard.java:11: ';' expected
That's strange, it should be saying
"Programmer has no idea what they are doing"
The first (broken) line you added is
clear in its intent, but is negated by
the second line.
You should hit some basic tutorials to
find out why, before plunging ahead
trying to fix a 50 or so Kb source
file that depends on other source files,
one of which is 40Kb.
You are not going to achieve what you
want by making random changes to the
source based upon suspicions you are
led to from usenet.
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
| |
| Andrew Thompson 2004-03-29, 9:39 pm |
| On Tue, 30 Mar 2004 01:33:56 GMT, Andrew Thompson wrote:
[color=darkred]
> On Mon, 29 Mar 2004 20:21:03 -0500, Mark wrote:
>
By the by.
Did anyone mention to you that one
source file may not compile cleanly
unless you compile them all together?
(You have a number of source files
in this project, don't you?)
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
| |
|
| Andrew Thompson wrote:
>On Tue, 30 Mar 2004 01:33:56 GMT, Andrew Thompson wrote:
>
>
>
>
>By the by.
>
>Did anyone mention to you that one
>source file may not compile cleanly
>unless you compile them all together?
>(You have a number of source files
>in this project, don't you?)
>
>
Well, Mr. Thompson, I bow to your superior intellect, and as such i GIVE
UP. I don't want to learn java, I simply wanted to try and fix this
little bug.
However, since you think I'm way out of my league, I'll throw this out
for you, and everyone else that might want to look at it. Ridicule me
all you want.
We have a saying in my profession. "Those that can, do. Those that
can't, instruct."....
The problem is this:
The package reads .pgn chess files, either single game or multiple game
files. PGN files are simply text files, if you've never seen one. If the
*first *pgn game that is in the file does NOT contain all of the tags
listed in chessboard.java starting at line 405
currentGameTags.event = "";
currentGameTags.site = "";
currentGameTags.date = "";
currentGameTags.round = "";
currentGameTags.white = "";
currentGameTags.black = "";
currentGameTags.whiteRating = "";
currentGameTags.blackRating = "";
currentGameTags.result = "";
currentGameTags.ECOCode = "";
currentGameTags.FEN = "";
Then the applet will not load properly (it's garbled), for the *first
game only*. If the file contains all of these tags OR it's the NEXT game
in the very same .pgn file, the applet displays properly.
Later in chessboard.java, the tags are all reset to "" at line 520
gameTags.event = "";
gameTags.site = "";
gameTags.date = "";
gameTags.round = "";
gameTags.white = "";
gameTags.black = "";
gameTags.whiteRating = "";
gameTags.blackRating = "";
gameTags.result = "";
gameTags.ECOCode = "";
gameTags.FEN = "";
My theory (oh pathetic peon that I am) is that if the tags contain data,
even null data, on first read, the garble will not occur, since the
garbling does not occur anywhere except the first game, since all these
tags are set to null after first read. If these fields are set to ""
before first read, then replaced witht the first read data, it might
stop this from happening.
You can view this in action here:
http://www.ragsman.com/chesstest/chesstest.htm
The first game is simply missing the "result" field in the .pgn. If I
were to add the result field into this game, it would work properly.
the other 2 games are missing more than that, with no garbling at all.
A sincere thanks to all of you that tried to help me.
Mark
| |
| Andrew Thompson 2004-03-30, 6:37 am |
| On Mon, 29 Mar 2004 22:18:02 -0500, Mark wrote:
> Andrew Thompson wrote:
<lot's of stuff the OP chose to ignore>
> Well, Mr. Thompson, I bow to your superior intellect,
A statement like that will immediately
brand you as a foolish individual to
those that know me.
>..and as such i GIVE
> UP. I don't want to learn java, I simply wanted to try and fix this
> little bug.
Pay someone. (Ya' cheap bastard)
> However, since you think I'm way out of my league, I'll throw this out
> for you, and everyone else that might want to look at it. Ridicule me
> all you want.
I'm about done, ..unless you post again.
> We have a saying in my profession.
The sex industry?
>.."Those that can, do. Those that
> can't, instruct."....
Ahhh, yes, profound sayings. Pity they
don't do you a shit-load of good.
And as I have always been saying. Get
youself some example codes* to see how
it's done**, proceed from there and within
no time you will have either..
a) fixed the problem.
b) realized it was more subtle than
you thought.***
* From the link in your first response to you..
<http://groups.google.com/groups?th=...784105fa0#link2>
** ..well, basically anything in Java!
*** Consult my site also for things like..
Applet/JRE versioning
<http://www.physci.org/codes/jre.jsp>
The Java plug-in (why you cannot assume it
is available - aactually that goes for .NET too)..
<http://www.physci.org/codes/java/plugin.jsp>
My 'solution' to the problem of the MS VM
<http://www.physci.org/jvmclean.jsp>
(..why you can be damn sure the MS VM will
become an ever more rare beast)
So to put it bluntly, get it together or
shrink back into the shadows. Either way
is fine by me, for someone that does not
seem to be able to gain from the advice offered.
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
|
|
|
|
|