compiler says that package does not exist...why?

I have a directory called myutil, and inside that, a class "PrintTeste". Out of package, one class called "Teste"...

See the code:

publicclass Teste{

/** Creates a new instance of Teste */

public Teste(){

myutil.PrintTeste.mPrint();

}

publicstaticvoid main(String []args){

Teste teste =new Teste();

}

}

inside package myutil:

package myutil;

publicclass PrintTeste{

publicstaticvoid mPrint(){

System.out.print("teste ");

}

}

using javac myutil/PrintTeste.java.... it's ok

But, when I try compile using javac Teste.java I receive the following message:

Teste.java:8: package myutil does not exist

myutil.PrintTeste.mPrint();

^

Using Netbeans 5.5, this error does not occur.

My environment variables CLASSPATH, JAVA_HOME AND PATH were right setted...I'm using Windows XP, jsdk 1.5.0_07

So, what could be happening?

Thank for yout help!

Eliselbert

[1778 byte] By [Eliselberta] at [2007-10-3 4:34:34]
# 1
A class in a package can't access a class that isn't in a package.This rule was brought in around 1.4 to resolve some ambiguity.
ejpa at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 2
Ok, but in this case, a class that is not in package tries to access the class inside the package....thanks for helpMessage was edited by: Eliselbert
Eliselberta at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 3
Your directory layout needs to look like this:../Teste.java./myutil./myutil/PrintTeste.java
ejpa at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 4
That's the way it is...../Teste.java./myutil./myutil/PrintTeste.javaThat's why I can't understand the error...the directory layout is correctThanksMessage was edited by: Eliselbert
Eliselberta at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 5
Dunno. Check the exact case of the filenames?
ejpa at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 6
I checked the case of filenames, and they are ok too...The mos odd is the fact that in Netbeans, these classes are complied withou problems, but when I try manually, occur this error.....Message was edited by: Eliselbert
Eliselberta at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 7
Tryjavac -classpath .myutil/PrintTeste.java.
atmguya at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 8

Fortunatly, the compile process ocurres well using:

javac -classpath . myutil/TestePrint.java

and

javac -classpath . Teste.java

but when I try run the class Teste, another error:

java Teste

Exception in trhead "main" java.lang.NoClassDefFoundError: Teste/class

Eliselberta at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...
# 9
Sorry GuysI forgot to use .classpath in java command...It was compiled without trouble....Thanks for your help
Eliselberta at 2007-7-14 22:38:13 > top of Java-index,Developer Tools,Java Compiler...