• Post Reply Bookmark Topic Watch Topic
  • New Topic

Network Class Loading and retrieving its method's return value  RSS feed

 
Soni Mitesh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Hello Rancher,
in the above program I am trying to load the class residing in the jar over network,
I am unable to call the methods of the class over the network, however class is getting loaded by using loadClass method.
the method of class over network returns one String only.

Thanks>
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You will certainly not want to ignore exceptions, then. Otherwise you will have no idea what went wrong. For a start put "e.printStackTrace()" into those empty catch-blocks.
 
Soni Mitesh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Paul That was quick,

I am finding it hard to write a line for method fetching
this is the method signature in class over network.



and finding problem how to call it in this code



i understand the method implementation this way



and same way in method



Thanks again Paul...
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Soni Mitesh wrote:and finding problem how to call it in this code


And are you going to explain that problem to us? There's no point in just telling us you have a problem.
 
Soni Mitesh
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
apologies Paul, javaranch

on console i am getting this error,
i am referring example from this link

referred Link



many Thanks
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the API documentation for the invoke() method of java.lang.reflect.Method specifically describes what it means if a NullPointerException is thrown. Have you read that?
 
Rob Spoor
Sheriff
Posts: 21131
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Paul is right. You can only use null if the method is static.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!