java - non-static method generatePublic(KeySpec) cannot be referenced from a static context -


i getting above error in particular line of code:

keyfactory keyfactory=keyfactory.getinstance(keyalgorithm);          encodedkeyspec privatekeyspec=new pkcs8encodedkeyspec(privatekeybytes);         privatekey privatekey1=keyfactory.generateprivate(privatekeyspec);  

to precise error get:

generatepublicprivatekeys.java:35: error: non-static method generatepublic(keysp ec) cannot referenced static context publickey publickey1=keyfactory.generatepublic(publickey spec); 

note: have gone through these posts
“non-static method cannot referenced static context” error
non static method cannot referenced static context
, more , have tried solutions provided there,but no not solve problem

what should do?
thankyou in advance:)

you need change

keyfactory.generatepublic(...) 

to be:

keyfactory.generatepublic(...) 

at moment code trying call generatepublic method if static (ie associated keyfactory class, rather object of type). need call method on specific instance of class - presumably keyfactory object refered in first code snippet.


Comments

  1. Java - Non-Static Method Generatepublic(Keyspec) Cannot Be Referenced
    From A Static Context - >>>>> Download Now

    >>>>> Download Full

    Java - Non-Static Method Generatepublic(Keyspec) Cannot Be Referenced
    From A Static Context - >>>>> Download LINK

    >>>>> Download Now

    Java - Non-Static Method Generatepublic(Keyspec) Cannot Be Referenced
    From A Static Context - >>>>> Download Full

    >>>>> Download LINK dq

    ReplyDelete

Post a Comment

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -