How to get Class Name given along with java.exe
Hi friends,
I am Mukesh, currently facing one problem
On command prompt to execute any java program we give :
C : \.-- > java ClassName
This ClassName I need in my application, I want to do some post processing on that.
Actually see what I want :
public class Base
{
static Base object;
public static void main(String[] args) throws Exception
{
object=(Base)Class.forName("Derived Class Name").newInstance();
}
void main()
{
}
}
public class Derived extends Base
{
void main()
{
System.out.println("Hello World");
}
}
I am trying to Run Derived Class, since there is no entry point found, default JVM invoke the Base class's entry point, there I want to load
Derived Class, but I am not getting any identity of derived class in Base class.
I found one temporary solution to this problem :
C: \ -- >java Derived Derived
& in Base class, I have loaded class
object=Class.forName(args[0]).newInstance();
But I dont want to write the same thing twise just to know the Class name which is given along with java.exe.
Is there any way to get the ClassName supplied with java.exe
I have tried a lot, still I am trying !!!
If any one knows the answer, help me.
Regards.
Mukesh.

