'HelloWorldSwing' is not recognised as an internal or external command, operable program or batch file.
-------------------------------------------------------------------------------- then u r not typing the java word...try again and see. It has nothing to with ur code.The problem is in the way u r running the program buddy
Paul - when you put something in code tags, please make sure the line contains line breaks. Otherwise you get a really long line that makes the rest of the page virtually unreadable. That is, it forces the whole page to be really wide, and we have to use the horizontal scrollbar to read each line. Ugh! Thanks.
That error occurs due to an improper change to a class. For instance say class A uses B.method. If B.method is changed but the corresponding invocation in class A is not, the latter will continue on calling the previous method, but because it was not recompiled the compiler doesn't warn you. NoSuchMethodError will be thrown by the JVM.
Because of the variety of problems you have experience so far, the best you can do is to delete all the classes in that directory and compile the program again.
SCJP2. Please Indent your code using UBB Code
posted 16 years ago
Sorry about that one mate...my bad...wont happen again
I have just deleted the two class files from my working dir. After i recompile, I get the two class files (as expected) ...when i go to run the program, I still get these errors
I tried it and it worked fine for me. What version of java are you using? (type java -version to find out). My guess is that you are not using a version that is 1.4 or greater. Here is how I figured it out:
The error says NoSuchmethodError and gives you line 12 in your code. line 12 is this: JFrame.setDefaultLookAndFeelDecorated(true); A quick check of the javadocs for Jframe.setDefaultLookAndFeelDecorated() says: "Since: 1.4 " Which means this method was added starting at 1.4. This means any JVM before 1.4 won't have that method and would give you a NoSuchMethodError.
So, either take out that line, or upgrade to a 1.4 or better JVM (I recommend upgrading)
Try to see if the classpath enviroment variable is pointing to a directory in which an old incompatible copy of HelloWorldSwing.class inhabits. That would make to load the untrusted class before the one you really want.
Such class could also be causing troubles in the extensions directory "C:\j2sdk1.4.2_04\jre\lib\ext"
You can see which are the classes really loaded via the option "-verbose:class" to java command. In the output look for "[Loaded HelloWorldSwing]". The absence of path means it was loaded from the current directory.