This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
Hello
i have a class called Hamzah inside a package called hamzah i tried to run it from Command line but always i have NoClassDefFoundError the class compiled correctly and .class file produced but it didn't run
i try to do the following :
1. For compiling go into the folder where you java file is :
==> C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com\hamzah>javac Hamzah.java>
2. Then come out all of your packages :
==> C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com\hamzah>cd..
3. Then use fully qualified name to run your class.
C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com>java hamzah.Hamzah
This is the method which I found, please somebody explain why do we have to do this. Does compiler don't know about packages whereas JVM know ?
1. For compiling go into the folder where you java file is :
==> C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com\hamzah>javac Hamzah.java>
2. Then come out all of your packages :
==> C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com\hamzah>cd..
3. Then use fully qualified name to run your class.
C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\com>java hamzah.Hamzah
This is the method which I found, please somebody explain why do we have to do this. Does compiler don't know about packages whereas JVM know ?
I found a solution for this
C:\Users\h.khammash\Desktop\Studening workspace\TestCmd\src\>java -cp . com.hamzah.Hamzah
-cp must be exist to run.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.
subject: Running class inside package in java from Cmd?