I know this may sound like a silly question, but I was wondering if there was a way to run Java Applets on my server and embed them to a page in a way that the user would not have to "allow access" to the applet, because it wouldn't have direct connection with their computer. In other words, make an embedded java applet which wouldn't download to the client side? I understand that the lifetime of an applet is only in the web browser when a user activates a plugin and all of that.. So how can I run Java APplets on my server?
Theoretically everything is possible. Applet is a special java application that extends Applet or JApplet. Applet just extends Panel. You can simulate applet container by implementing your own dummy appet context and run applet on server side.
Now, you can capture its UI and stream it to browser using AJAX or even web sockets. You can catch mouse and keyboard events in browser, send them using ajax to server where your applet is running and emulate the same events on your applets.
But may I ask you "why?" I think these efforts can be reasonable only if you have a huge applet and do not want to re-implement it using other technologies. But IMHO it is easier to re-write your applet using ExtJs or GWT. In GWT it is probably the better way because GWT is a java that is compiled to javascript, so you will probably be able to reuse most of your code.
Related
I have created a Swing application in Netbeans that is basically a chat system (between multiple clients and server using socket programming).
Now I wanted to run this application on a webpage. Is this possible without changing any code?
Now I wanted to run this application on a webpage. Is this possible without changing any code?
No. It would have to be a JApplet to be embedded in a web page, and applets have been effectively killed off. See Java Plugin support deprecated and Moving to a Plugin-Free Web.
On the other hand, a desktop application (based on a JFrame) can be launched from a link on a web page using Java Web Start.
Edit
Scrap that advice regarding JWS, apparently it too is being deprecated as of Java 9.
In my web application I need to launch a Windows application installed on client machine when a button in the page is clicked.
I know there are security policies in browsers that avoid this by default, but I also know application that do this. An example could be online meeting, web conferencing applications like WebEx or GoToMeeting.
How they do that?
I'm working with Java, so I'm wondering if Java Applets are an option to achieve this.
Is there some other well known way to solve this issue?
NOTE application execution MUST be allowed by user
The best way to deploy a Java desktop application is using Java Web Start.
And forget applets. Soon Chrome won't be able to load them (along with a number of other plug-ins) at all.
you can achieve it with applet. but user must allow to run it. it is hard to run some extern application from button or link because this is potentially danger behaviour. Remember the applet can not get access to the files on user computer and other servers (unless it is digitally signed)
Is it possible to open an exe application (Not launch an application) inside a web browser. I want it to be like you have embeded the application in your browser. Is that posible in VB.NET or in JAVA? I have provided the launch application. but my boss wants it to be inside the web browser, not launched by the browser. Thanks in advance
The browser naturally prevents this capability because it would be an enormous security hole. The only way I could see you achieving this is to write some sort of browser plugin or browser extension which would allow you to achieve this but with all of the responsibilities and risks of writing this kind of code.
I want to make a Java applet, which functions as a socket server (local network ips, or 127 range is fine).
I want this applet to run in a webpage.
the browser can ideally load the webpage from the file system (file://...), but I could install an HTTP server if required.
The applet will need to be able to interact with JavaScript.
I'm having trouble wading through all the docs. Is the above possible? I'm not familiar with java's security model. If I need to sign the applet, or set some special security or configuration settings, that's fine.
edit-
In case anyones curious, the applet does very little. I just want to use it as a bridge so that another program running on the local computer can communicate via sockets. That program supplies values, which javascript will use to update the ui in real time. The ui is complicated, and building it in html/javascript will be a huge time saver. I'd prefer the applet function as the socket server opposed to a socket client, because otherwise then I need to write a seperate program to act as a server in between the applet and the other program.
Is the above possible?
Sure. If you control the security/policy files for that applet & the firewall, it is a single browser deal, it should be doable. You might need to wrap some of the applet methods in a PrivilegedAction if called from JS.
This question might be very basic.
Till now I thought a command to print a webpage can only be initiated at the client side.
(window.print when using javascript)
But I came across http://juixe.com/techknow/index.php/2008/01/17/print-a-pdf-document-in-java/ which states about printing using Java. I think this seems to be related to some desktop client and the same may not be possible in a web client. Can anyone confirm and explain this?
You can't execute server side code on the client, so the only way to do it in browser is through javascript or using plugins/flash/java applets.
You could print using java, but for that java needs to run on the client.
A website can ask the browser to open its print dialog (Google Maps does this on the "print directions" page, for example), but it can't actually force the browser to print anything. (If it could, you can be sure that advertisers would use it to print ads on your printer.)
A Java application running locally with sufficient permissions can print, just like any other desktop application. That has nothing to do with web pages.
Don't confuse Java and JavaScript. When trying to use Java within a browser, you'd have to look into using applets. A Java applet could definitely be used to do the kind of work you'd normally have a rich client do from within a browser.
Java applets could also receive events sent out from a server via sockets or some other mechanism, although I'm not certain if security constraints would allow it. Also seems a bit of a roundabout way to do things.
Remember that web browsing is a client-side-driven affair. There's some push models in certain infrastructures (I believe it's possible using JavaServer Faces). But those are probably just a sort of polling mechanism initiated by the client that is abstracted away to look like a server-side push.