If you need Java in your browser, the only way is applets.
But the usual (unreliable) applet:
- unable to access files on local system
- can't listen on any ports
- can only open sockets on the server.
This is for security reasons: the applet should not harm the user on which it works.
So, if you want to do what you said, you need the user to trust you and give you more permissions. To access the files, the JNLP API path (that is, launching your applet using the jnlp file and then using the API in javax.jnlp , especially FileOpenService and FileSaveService. Then, the user must confirm access before selecting the file using file selection.
This still does not help in accessing the network - your applets should have the appropriate SocketPermissions there if you do not want to proxy everything on your server (which should not be peer-to-peer). To do this, you need to sign your applet and request all permissions from the user (there is no more subtle way to provide only the necessary SocketPermissions, I think). You can do this in the jnlp file.
PaΕlo Ebermann
source share