Results 1 to 11 of 11
- 09-01-2009, 06:27 PM #1
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
package src.Verbs clashes with class of same name
Woot woot?
I dont get it!
I got alot of packages inside the folder Verbs.
And when I make em packages i say:
package src.Verbs;
Now I got no script names verbs or anything in the folder named src with the name Verbs.
Still I get this error! Why?
Heres my script, they all look kinda like this:
PHP Code:package src.Verbs; import src.Operations; public class SimplePresent { public static Boolean Test(String string) { String[] verbs = string.split(" "); for ( int x = 0;x<verbs.length;x++){ String word = verbs[x]; if (word.substring(word.length()-3,word.length()).equals("ies")){ word = word.substring(1,word.length()-3); if (Operations.Find("Verbs.txt",word) != false){ return true; } } else { if (word.substring(word.length()-2,word.length()).equals("es")){ word = word.substring(1,word.length()-2); if (Operations.Find("Verbs.txt",word) != false){ return true; } } else { if (word.substring(word.length()-2,word.length()).equals("es")){ word = word.substring(1,word.length()-2); if (Operations.Find("Verbs.txt",word) != false){ return true; } } } } } return false; } }
- 09-01-2009, 06:37 PM #2
Each package has to be in it's own folder, i believe. Is that the issue?
/src/Verbs/SimplePresent.javaMy Hobby Project: LegacyClone
-
- 09-01-2009, 06:50 PM #4
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
So you have a class called src.Verbs and a package called src.Verbs as well?
The compiler will give you a warning for that.
If that is not the case then post the exact error message you are getting.
- 09-01-2009, 07:34 PM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
I tought when wrighting a package i should wright;
package pathFromClassPathToScript;
so the script is inside the Verbs forder.
the Verbs fordel inside the src folder, and the src folder inside the classpath folder.
So shouldnt it be src.Verbs; for all packages inside the verb folder?
- 09-01-2009, 07:50 PM #6
"for all packages inside the verb folder"
This statement doesn't make sense.
A package is a collection of classes (NOT SCRIPTS! :P) contained in a folder.
A class belongs to a package but is not a package.
To say:
is to say that this class belongs to this package which happens to also give it's location in the folder structure.Java Code:package pathFromClassPathToScript;
Example:
%ClassPath%/project
package project;
%ClassPath%/project/verbs
package project.verbs;
Also:
import project.verbs.*; //to access the classes in this package from outside the packageLast edited by mrmatt1111; 09-01-2009 at 07:56 PM.
My Hobby Project: LegacyClone
- 09-01-2009, 08:41 PM #7
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Ok so how do I make it a package?
package src.Verbs SimplePresentForFutureEvents;
Will only cause the error "; expected"
and
package src.Verbs.SimplePresentForFutureEvents;
doesnt help..
NOTHING works!
What am I suppose to do!
- 09-01-2009, 08:44 PM #8
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Read the tutorials. Don't bother trying to write a single line of code before reading the relevant tutorial.
Start here.
- 09-01-2009, 08:45 PM #9
it assumes this path:Java Code:package src.Verbs; public class SimplePresentForFutureEvents { ... }
%ClassPath%/src/Verbs/SimplePresentForFutureEvents.javaMy Hobby Project: LegacyClone
- 09-01-2009, 08:47 PM #10
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Yes, that is what I already have, still I get the error...
- 09-01-2009, 10:53 PM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 294
- Rep Power
- 0
Similar Threads
-
[SOLVED] Open a different class from the same package when button clicked.
By mainy in forum AWT / SwingReplies: 4Last Post: 02-16-2009, 03:20 PM -
[SOLVED] Compiling Package Class
By nwboy74 in forum New To JavaReplies: 3Last Post: 11-14-2008, 11:19 PM -
How to use Stack class in java.util package
By Java Tip in forum java.langReplies: 0Last Post: 04-16-2008, 10:32 PM -
Compiling a class in a package from cmd
By Java Tip in forum Java TipReplies: 0Last Post: 12-17-2007, 10:27 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks