Q. Hi,
Im with a real problem here n00b . can not seem to get a “Hello World” program put to work . (
Cmon not laugh at me .:)
Im getting the error Exception in thread “main” java.lang.NoClassDefFoundError: cript / class. Search on Google, I think it has something to do with classpath or something similar, but can not seem to put . I attached code with the steps I took.
For quick reference:
Filename: cript.java
Contents:
class cript (977 503 public static void main (String [] args) (977 503 System.out.println (“This s ** t does t work! n “))
)
My set environment variables:
CLASSPATH =.; C: Program Files SQLLIB db2java.zip java, C: Program Files SQLLIB runtime.zip java, C: Program Files SQLLIB bin
Path = C: WINDOWS system32 ; C: WINDOWS C: WINDOWS Sys tem32 Wbem C: Program Files SQLLIB BIN, C: Program Files SQLLIB FUNCTION C: Program Files SQLLIB HELP C: Program Files j2sdk1.4.2_05 bin
Thanks for help .
Re:Originally posted by: guy
To elaborate: if you don't explicitly call some super constructor the compiler will insert a call for you. It will either be to the no-arg constructor. In your case, it doesn't exist and for good reason. You can't have a File that isn't linked to a real file somewhere. Therefore you should at least define FileExtend(String filename) from which you should call super(filename). If you really only want to change your one method then you should also implement the other constructors as pass-throughs in the same manner
Yes, I understand now, thank you for the explanation ![]()
Re:To elaborate: if you don't explicitly call some super constructor the compiler will insert a call for you. It will either be to the no-arg constructor. In your case, it doesn't exist and for good reason. You can't have a File that isn't linked to a real file somewhere. Therefore you should at least define FileExtend(String filename) from which you should call super(filename). If you really only want to change your one method then you should also implement the other constructors as pass-throughs in the same manner
Re:Originally posted by: guy
Hi, I'm re-using this thread for another question:
I'm trying to create a class, as an extention of another one. I want a class to have all functionality of the java.io.File class, plus another method I want to add.
So, I created the class as follows (I'm using Eclipse 3.0):
package pckTeste;
import java.io.File;
public class FileExtend extends File {
public FileExtend() {
}
}
The problem is that eclipse underlines the text "FileExtend()", as an error, and gives me the following error description:
"Implicit super constructor File() is undefined. Must explicitly invoke another constructor"
I'm trying to put it to work, but there is some basic point I'm missing here … anyone can help?
<edit>
I believe this as something to do with the super(); contructor maybe, but this is still a bit confusing to me … I'm googling for any info about this, but any help would certainly be welcomed …
</edit>
Thank you.
As you can see- http://java.sun.com/j2se/1.4.2…/api/java/io/File.html (http://java.sun.com/j2se/1.4.2/docs/api/java/io/File.html) – , there isn't a defualt constructor(no args) so the compiler is confused about what it should call. You can help it by making an explicit call to a certain one by calling super(args, go, here) and it will call that constructor.
Re:Hi, I'm re-using this thread for another question:
I'm trying to create a class, as an extention of another one. I want a class to have all functionality of the java.io.File class, plus another method I want to add.
So, I created the class as follows (I'm using Eclipse 3.0):
package pckTeste;
import java.io.File;
public class FileExtend extends File {
public FileExtend() {
}
}
The problem is that eclipse underlines the text "FileExtend()", as an error, and gives me the following error description:
"Implicit super constructor File() is undefined. Must explicitly invoke another constructor"
I'm trying to put it to work, but there is some basic point I'm missing here … anyone can help?
<edit>
I believe this as something to do with the super(); contructor maybe, but this is still a bit confusing to me … I'm googling for any info about this, but any help would certainly be welcomed …
</edit>
Thank you.
Re:Originally posted by: guy
Originally posted by: guy
eh one line PHP:
I prefer this myself
Using <?= often isn't such a great idea:
http://www.zend.com/manual/language.basic-syntax.php
You could do it like this
<php? ?>Hello World<php? ?>
![]()
Re:Originally posted by: guy
Originally posted by: guy
Don't type "java cript.class". You don't want to add the .class file extension. Just type "java cript".
I can only say … :Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q
I was getting shocked as I read your answer! I tried everything! Well, everything except what you told me!
I was sure it should be something simple, but even the simplest thing has it's own bottom limitations! lol
Thanks. It works now.
Very common mistake. Don't sweat it. ![]()
Re:Originally posted by: guy
eh one line PHP:
I prefer this myself
Using <?= often isn't such a great idea:
http://www.zend.com/manual/language.basic-syntax.php
Re:eh one line PHP:
I prefer this myself ![]()
Re:Originally posted by: guy
Here it is in PHP in case you ever want to know.
I can do it in a single line of shell script, but shell certainly isn't superior. ![]()
Re:Here it is in PHP in case you ever want to know.
Re:Originally posted by: guy
Originally posted by: guy
Don't type "java cript.class". You don't want to add the .class file extension. Just type "java cript".
I can only say … :Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q
I was getting shocked as I read your answer! I tried everything! Well, everything except what you told me!
I was sure it should be something simple, but even the simplest thing has it's own bottom limitations! lol
Thanks. It works now.
Consider yourself shot
Re:Originally posted by: guy
Don't type "java cript.class". You don't want to add the .class file extension. Just type "java cript".
I can only say … :Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q:Q
I was getting shocked as I read your answer! I tried everything! Well, everything except what you told me!
I was sure it should be something simple, but even the simplest thing has it's own bottom limitations! lol
Thanks. It works now.
Re:Don't type "java cript.class". You don't want to add the .class file extension. Just type "java cript".
Re:I've tried it … no result, same problem …
Also checking Java Sun Tutorials (http://java.sun.com/docs/books/tutorial/getStarted/application/index.html), they have a similar code (but one that works) – I pasted it on attach.
Here on my machine, it comes up dead
Any ideas?
Re:You forgot to make the class public. By default java makes classes and methods private. I attached code with the fix.
0 Comments.