I'm not sure with RFD's community of programmers...but you could try Sun's Java Dev forums... good luck.
-
Oct 17th, 2006 03:41 PM #1
Need some help with Java
New post.
My teacher has us writing portions of code. We're supposed to use two of his class files and use some methods from his .class files. However, whenever I try to use any the methods in his code I get errors when I try to compile my code saying there needs to be a .java file to go along with it.
Any help would be greatly appreciated.Last edited by Evil Baby; Nov 14th, 2006 at 11:39 PM.
_______________
HEATWARE (21 - 0) - evilbaby
Reply With Quote
LOG IN TO THANK
No one has yet thanked Evil Baby for this post.
-
Sponsored Links - Join the RedFlagDeals.com community and remove this ad.
-
Oct 17th, 2006 09:24 PM #2
Reply With Quote
LOG IN TO THANK
No one has yet thanked fuj_duong for this post.
-
Oct 17th, 2006 10:18 PM #3
Not sure, need comments in the code. :P Could it be because of this?
m_yPos += 100;
Hmm, there doesn't seem to be m_xPos incrementing.Last edited by fwhc022883; Oct 17th, 2006 at 10:24 PM.
_______________
http://www.startwithsoup.com
Reply With Quote
LOG IN TO THANK
No one has yet thanked fwhc022883 for this post.
-
Nov 14th, 2006 11:39 PM #4
new OP
_______________
HEATWARE (21 - 0) - evilbaby
Reply With Quote
LOG IN TO THANK
No one has yet thanked Evil Baby for this post.
-
Nov 15th, 2006 12:42 AM #5
.class files cannot run on all machines. He should be giving you the .java files instead.
Reply With Quote
LOG IN TO THANK
No one has yet thanked evanx for this post.
-
Nov 15th, 2006 01:05 AM #6
Reply With Quote
LOG IN TO THANK
No one has yet thanked dasaylay for this post.
-
Nov 15th, 2006 07:41 AM #7
Class files are fine. Just make sure you import it if its part of another package, and make sure the compiler knows where to find it.
Reply With Quote
LOG IN TO THANK
No one has yet thanked Nyte for this post.
-
Nov 15th, 2006 07:42 AM #8
Reply With Quote
LOG IN TO THANK
No one has yet thanked Nyte for this post.
-
Nov 15th, 2006 08:35 AM #9
.class files can run on most machines as long as you have the right JVM/JRE (unless we're talking about embedded devices)...that's the whole point of having the bytecode, to be OS and arch independent and re-interprete by the JVM as the middleware between the OS and the bytecode.
Some pre 1.4 class files might not run on newer JVMs...but since 1.4, there's an option for Java1.4 compatible bytecode output. Now, 1.6, 1.5 and 1.4 can run the same code without having to recompile.
Also, one of the point of having OOP is so that each object can be abstract away from the code (.java) and only distribute what you need, .class files. It's therefore easy to be reused and clear (method calls), also, again, arch and OS independent.
Reply With Quote
LOG IN TO THANK
No one has yet thanked chatbox for this post.
-
Nov 15th, 2006 10:27 AM #10
OP, what compiler are you using? Command line, or an IDE like Eclipse?
As was said, you just have to ensure that the class file is in the class path.
Reply With Quote
LOG IN TO THANK
No one has yet thanked temporalillusion for this post.
-
Nov 15th, 2006 10:33 AM #11Deal Addict




- Join Date
- Nov 3rd, 2004
- Location
- Mississauga
- Posts
- 1,387
Reply With Quote
LOG IN TO THANK
No one has yet thanked jm20 for this post.
-
Nov 15th, 2006 03:21 PM #12
Figured it out. I was just being really really really stupid. I was trying to create to public classes within in one .java file. I needed a good nights rest then I got it. haha.
Thanks for the help though._______________
HEATWARE (21 - 0) - evilbaby
Reply With Quote
LOG IN TO THANK
No one has yet thanked Evil Baby for this post.
Search Forums



