Results 1 to 7 of 7
- 05-14-2010, 05:07 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 34
- Rep Power
- 0
Wierd problem with abstract and extends
For some weird reason i can no longer compile things that i could compile.. in fact it was so strange that i went back to the java sun official tutorials and tried to compile an example
Java Code:abstract class GraphicObject { int x, y; void moveTo(int newX, int newY) { } abstract void draw(); abstract void resize(); }
and
Java Code:class Circle extends GraphicObject { void draw() { } void resize() { } } class Rectangle extends GraphicObject { void draw() { } void resize() { } }
this which is an example from a java tutorial in java official website
gives the following error :
after typing /javac GraphicObject.java
it compiles correctly ( note thats the abstract class )
after typing /javac Circle.java it says it can't find the GraphicObject class which i am trying to extend..
I don't think i have really changed my JRE or my JDK at all for 1 year now and i am almost sure that the last time i tried to compile such a thing it worked... and whats even more weird is that netbeans finds it as an error too while this tutorial is quite popular in the internet..
also let me note that the java files are all in the same folders...
- 05-14-2010, 05:37 PM #2
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
I had no difficulty compiling the classes you listed.
Here is my set-up and the procedure I followed.
(I did nothing exceptional.)
I'm using Windows XP, and Java 1.6.
I have a cmd console on the desktop, which I
click on to access java. (no Eclipse, netbeans,
or anything fancey.)
I broke up your code into three seperate files
and compiled them in this order:
javac GraphicObject.java
javac Circle.java
javac Rectangle.java
I did everything the way I would do any other
code and I had no problems.
- 05-14-2010, 05:48 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 34
- Rep Power
- 0
i did the same and i have problems.. whats going on? javac problem?
- 05-14-2010, 06:06 PM #4
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
There is very little more that I can add,
other than the
GraphicObject.class
Circle.class
Rectangle.class
files appeared on the desktop after compiling.
- 05-14-2010, 06:13 PM #5
Senior Member
- Join Date
- Mar 2010
- Posts
- 953
- Rep Power
- 4
My guess (and it is just a guess) is that you have a CLASSPATH, and "." representing the current directory is not in it. The default CLASSPATH is just "." which should not give the results you are seeing. Again, it's just a guess, but it may get you started in a helpful direction.
-Gary-
- 05-14-2010, 06:17 PM #6
Member
- Join Date
- Dec 2009
- Posts
- 34
- Rep Power
- 0
yeah could be i will just try to re-make the system variables for the java runtime enviroment
hmm i have changed the classpath recently to set up apache's ant for easier compilations maybe thats the problemLast edited by g123456; 05-14-2010 at 06:19 PM.
- 05-14-2010, 06:25 PM #7
Member
- Join Date
- Dec 2009
- Posts
- 34
- Rep Power
- 0
Similar Threads
-
wierd NetBeans problem.
By edi.gotieb in forum Forum LobbyReplies: 2Last Post: 10-09-2010, 01:31 PM -
Abstract, toString, inherits Class & other Problem !
By tking88 in forum New To JavaReplies: 2Last Post: 10-23-2009, 02:48 AM -
...is not abstract and does not override abstract method...
By Addez in forum New To JavaReplies: 3Last Post: 09-16-2009, 09:27 PM -
GameImpl is not abstract and does not override abstract method
By Macca07 in forum New To JavaReplies: 2Last Post: 11-21-2008, 12:20 AM -
wierd problem
By f_the_cook in forum Advanced JavaReplies: 4Last Post: 10-09-2008, 05:13 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks