"lots of errors"
When I compilate my java sourcecode with "javac"-command, I allways get the answare "100 errors" (or a other high, like 58 and so on), and it stays witch errors, but I know that isnt wrong. I have tested to take sourcecode directly from internet pages, so I know them are correct. Anyone who recognise this cind of problem and know the answare pls type it in!!!!
(if I type in "java -version" in cmd I get the answare:
java version "1.5.0_06")
Exuse my bad english i hope understood it :P Im from sweden;)(I dont know how the spellchecker work:P)
[572 byte] By [
java_norda] at [2007-10-2 18:51:58]

If you can, please post a small example of code and the exact errors that are generated.
As I said it stays that it found 100 errors, so I don't think I can rewrite every thing, but here I link to a screenshot I have taked on the compilated code
http://www.geocities.com/klan_col/kontakt
And the sourcecode have I taked from a internetside (so I know its correct) Here is the exactly code I compilated:
public class Ellsworth {
public static void main(String[] arguments) {
String line1 = "The advancement of the arts, from year\n";
String line2 = "to year, taxes our credulity, and seems\n";
String line3 = "to presage the arrival of that period\n";
String line4 = "when human improvement must end.";
String quote = line1 + line2 + line3 + line4;
String speaker = "Henry Ellsworth";
String title = "U.S. Commissioner of Patents";
String from = "1843 Annual Report of the Patent Office";
System.out.println('\u0022' + quote + '\u0022');
System.out.println("\t" + speaker);
System.out.println("\t" + title);
System.out.println("\t" + from);
}
}
class Frukt {
private static int antalFrukter = 0;
private int nummer = ++antalFrukter;
private int vikt;
}
class Apelsin extends Frukt {
private int antalKlyftor;
}
class Banan extends Frukt {
private int kr鰇ningsradie;
}
class 膒ple extends Frukt {
private int kr鰇ningsradie;
}
public class Uppgift2 {
public static void main(String[] args) {
Frukt f = new Frukt();
Apelsin a = new Apelsin();
Banan b = new Banan();
膒ple ?= new 膒ple();
}
}
(dont care about the swedish words). I hope this was to help!!!
Sorry, it does not help. Please try to compile only the Ellsworth code and copy and paste at least some of the errors. All the code you posted compiles fine for me.
didnt the screenshot work? I compilate in cdm and i dont know how to copy from thare. and it takes very long time to rewrite it. On the screenshot you can se the last 20 of the 100 errors. But do you meen I shall write down them in this page? One thing that i see is that every error is something with "illegal character", and than it is a litle mark on every character(and blanks).
But isnt thare any other way to compilate you programs, maybee a free program or something?
Many people on these forums, including me, are reluctant to go to a web page. For one thing, someone in the future may have a similar problem so it is good to capture the data here.
At any rate, it looks like the source code is not in ASCII text. Your display shows like the first line below, while it should show like the second line S t r i n g l i n e
String lineSee how it looks like extra spaces between each character? I believe you can convince javac to use different encoding by using the -encoding option, but I have never used it and I don't know for sure how to use it. For example, it might be "javac -encoding UTF-16 the_file.java"
The other way, which might be easier, is to load the contents of the file into a text editor and save it in ASCII format. Keep in mind that I am guessing that the encoding is your problem.
thanks, it was the coding, but i couldnt change to ACSII because it didnt stay as a alternative in the list. So I changed it to UTF-8 and used the encoding command you talked about.
But now it is an other problem:
now it sayes that it is 1 error, and it points at a little ?in the begining of the first line. But in the code isnt it a " ?".
And I understand that you are reluctant to visit strange webpages.
Now I write exactly what it sayes in cmd:
Ellsworth.java:1: illegal character: \65279
?╗┐public class Ellsworth {
^
1 error
C:\
The arrow points at the ?. But nor the ? nor the ╗┐is there in the real code, so I cant take it away.
That last problem i talked about, with ?and that isnt any longer a problem, becouse I use an other code now.
At least I could compile it, but when I shall drive it an other problem appears ( now I drive an other program, prim.java) with the command:
java prim
Than it sayes:
Exeption in thread "main" java.lang.NoClassDefFoundError: Prim
So I can compile my program but not drive it...
> java prim
>
> Than it sayes:
>
> Exeption in thread "main"
> java.lang.NoClassDefFoundError: Prim
>
> So I can compile my program but not drive it...
Glad you got it to compile. Ok, now you have a Classpath issue. First of all, Prim is not equal to prim as far as Java is concerned. If the name of the class is Prim, then the command must be "java Prim"
It might work with "java -classpath . Prim" assuming the Prim.class file is in the current directory.
Also, if the class is in a named package, then the command must include the package name and you must have the Prim.class file in a directory structure that matches the package name. For example, if you have ./the/package/name/Prim.class then use "java -classpath . the.package.name.Prim"
the command -classpath didnt work, but on one forum i read that -cp should work so i tested to write:java -cp . primi think cp is short for classpath. And it works now!!!!!!!!!!Thanks very much for your help!!!
Glad you got it working. FYI -cp is the same as -classpath. Some versions of java did not support -cp.