I have a Java file named Customer.java, in a folder d:/sample directory. But when I use Class.forName("d:/sample/Customer") it throws an exception as file not found. I tried with Class.forName("d:/sample/Customer.java") also but get the same exception. Can any one help me?
I have a Java file named Customer.java , in a folder d:/sample directory .
Share
1: class to be loaded
2: save the file to : d:/example/com/test/Example.java
2: compile the class:
…
3: write test class:
4: compile the class:
…
5: run the program:
result: