I am having code in java using this i am able to operate hardware. if i created API in java, will it accessible in ignition perspective through JavaScript.
Yes and no.
The "yes" part: If you have a java API library you wish to use in Ignition, you can drop it into certain folders of the Ignition install, and they'll be picked up on gateway restart. Those folders are blown away on gateway upgrades, so you'll have to repeat every time. Or, preferred, would be to wrap the library in an SDK module. Those carry forward with upgrades.
The "no" part: The library will be available in jython, not in javascript. Perspective has no support for running javascript in the browser. (There are tricks available to get limited amounts of javascript injected.) To properly expose a library to the browser, and make it possible to run arbitrary code in the browser, you will need to use the SDK to make a Perspective add-on component.
ok thank you for this information.