Pergunta

I'm trying to use ClassParser to get method parameter names, ClassParser constructor takes class name as parameter for example:

ClassParser parser = new ClassParser("Main.class");

I 'm trying to set the parameter to String class I 've tried to use "String.class" but it doesn't work. I've also used "java.lang.String.class" but it doesn't work. Finally, I've tried this.getClass().getResource("java/lang/String").toString() but also this doesn't work. How can I solve this?

Thanks

Foi útil?

Solução

I guess this is BCEL? Then ClassParser does not really take a a class name parameter, but rather an input stream, a file name or a zip file and entry (a.k.a jar file entry). I would expect that

ClassParser parser = new ClassParser("your/package/name/Main.class");

would work, given that your class is not part of a jar file.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top