I want to dynamically create a Class from a String.
The String has the exact name of the Class (by the way is a Java class)
For example
val classString = "gui.MainFrame"
I create the class with
val mainClass: Class[_] = Class.forName(classString)
Scala founds the class, but if i want to use this class for example with
AppExecutor.executeNoBlock(classOf[mainClass])
Scala tells me that type mainClass cannot be found.
If i use it in that way
AppExecutor.executeNoBlock(mainClass.asInstanceOf)
it says that java.lang.Class cannot be cast to scala.runtime.Nothing$ So how can i use this class now?