Java Compatibility
I have been having some trouble with making a custom browser I am using a default class provided by oracle for a custom browser. One thing I noticed with the browser is that it cannot run java applets without some sort of variation of java browser plugins. How exactly do normal browsers receive information from a web server to run a java program externally? Is there any way to somehow point the browser toward the jre to run the app like on a normal browser. Just need somewhere to start. FireFox apparently references some sort of MIME format under the npjp2.dll native found in the jre directory. Thanks Very Much.
Oracle Example
You can provide the user with a standard html download page in order for him to download a JNLP file which is the standard file to start a java web start app (applet). If the user's system has java installed, it must recognize the .jnlp file and assosiate it as a java app. It's an extra step, for the user to manually download the file instead of running automatically on a web browser, however because of recent security loopholes on java web implementations, most browsers don't trust java anymore, therefore the blocking. If you insist on setting up a web start app in a browser you must make sure that all users have appropriate security configurations on ther java installation (very unlikely).
EDIT:
Here's a very nice tutorial on how to achieve what I just explained.
TUTORIAL
Related
So, how much trust do I need to have in a publisher before I run their applet in the web browser?
In other words, I understand that a java applet is run in a sandbox in the browser, but this article suggests that the applet can actually access files stored on the local computer.
Can you please clarify the security limits of a java applet run in a modern browser, such as Firefox 50?
I understand that a java applet is run in a sandbox in the browser, but this article suggests that the applet can actually access files stored on the local computer.
There are potentially three different levels of security available to a Java applet.
The first is as you described 'sandboxed'. They can only access resources from their own server, nothing on your local file system unless they are launched using Java Web Start & will thereby have access to the services of the JNLP API. You might note that two of the services are the FileOpenService / FileSaveService! If the applet goes to use these, the end user will be prompted to permit the action via a dialog that states what the applet is trying to do, and asking for permission to proceed (to show a file chooser & go from there). These services provide back a 'file like' object that is more limited than the normal File API would supply. For example, it will not provide the path to the resource, just it's name and access to the content.
The level up from that can be specified in the launch file - '(J2EE) application client permissions'. This level removes the prompts for use of the JNLP API services.
The highest level of access is obtained by requesting, and being granted, 'all permissions'. Then the applet should have full access to File objects, be able to communicate with servers other than the one that launched it, etc. One of the few things they would still not be permitted to do in this mode is to call System.exit(n) to effectively 'kill the JRE' - this is something that is commonly done in other desktop apps.
But then there are JRE bugs, that screw all that up. Sun, then Oracle, kept stuffing up security so poorly (& regularly) that many browser manufacturers are entirely removing the support for applets (and other embedded objects requiring plug-ins) in web pages.
See Java Plugin support deprecated and Moving to a Plugin-Free Web for more detail.
..how much trust do I need to have in a publisher before I run their applet in the web browser?
I cannot answer for you, but my take would be that I would need to know them personally, and trust completely both their integrity and competence before I'd run their code in any browser I controlled.
Having said that, I don't think I have a single browser installed that even supports applets, and my complete lack of motivation to set something up, is probably a good view on whether I'd allow applets to run on this PC at all.
I have created a Java applet as part of a request from a client for a web-based program, and while I've gotten it embedded, Chrome has disabled support, you need to bypass various security protocols in both Internet Explorer and Firefox, and Edge doesn't have support for java in the first place. My question is, is there some sort of way we can run this program through a wrapper or an alternative way of getting it on the web without re-writing the entire program in a different language? Thanks!
Realistically, as you're seeing, applets are dead. Your best option is to use Java Web Start and convert your applet into an application. That really isn't too bad to do but it will require some work.
Basically the server sends a JNLP file that runs an application. The application (i.e. your Java application) can be downloaded from a remote server so that you don't have to have pre-installed anything except for Java on the client machine.
I have a html file, there are links in it, I wonder if there is a way to use those links to call a java program to generate another html file ?
Something like this :
<Html>
<body>
Some text
<A Href=[somehow point to a java .class file to run]>My Link</A>
More text
</Body>
</Html>
I know how to use Java to generate html, what I'm asking here is how to pass a parameter to this local java class so that it can generate html file with the input ?
So if the Java program is called : MyHtmlGen.java
Then the class will be MyHtmlGen.class
And then if I run it from the command line, it would be like this :
> java MyHtmlGen my_input
But I don't know how to turn that into the html link above ?
You could use WebStart to launch an Java application from a browser interaction.
The section of the linked documentation titled: "Running a Java Web Start Application From a Browser" provides a demo you can try. The link to the Java application is provided as:
Launch Notepad Application
That documentation states that when you click the link:
Java Web Start software loads and runs the application based on instructions in the JNLP file.
That isn't the behavior I get on Safari 7.1 on OS X 10.9 with Oracle Java 8u40 installed. Instead, I just get the jnlp file downloaded and can double click on the downloaded file to run the application. I think on some browsers, Oracle may provide a plugin to the browser which is able to launch the jnlp referenced application automatically without the user having to also double click on a downloaded jnlp file. Perhaps if the Java deployment toolkit were used, rather than a straight a href link, the user experience might be a bit more seamless.
Note: browser manufacturers have been phasing out support for plugin technology like this, so the experience or even the ability to automatically run the referenced application may vary for both you and your users. Additionally, allowing such plugins to run within a browser environment can increase the security attack vulnerability surface for a user's browser. WebStart is also quick a tricky technology to use and support for your users. So for these reasons I normally don't recommend using WebStart as a deployment solution.
That's just impossible. A link <a> will fire a GET request to the server for the URI set in the href attribute, it's not meant to execute a specific piece of code. If you want to execute code when clicking a link, use JavaScript, but be aware that JavaScript cannot start an instance of JVM and run your exact Java application.
On the other hand, maybe you should look into Applet or JavaFX and embed the java application in your page. Or probably you may submit an action to the server, and at server side you may start the JVM and execute your Java code.
I have a Java Application, which was created in an IDE (NetBeans) (JDK 1.6). The application allows sales people to enter sales info and have the approver come in to approve the entry. Saving the entry. The application is connected to a Derby DB.
Once this application is completed, I need to be able to distribute this application to the users so they can easily access the application.
The users would obviously need to be able to run this application without using an IDE, and if possible I would like to package it with the JRE so the users do not have to download the JRE (although it is not the end of the world if they must download the JRE).
This application will have different versions as we move along so it must be a process that can be either automatically updated or easily updated by a non technical professional.
Also there is a team SharePoint page, if possible I would like to be able to wrap this in some type of .exe file and then load that file in the SharePoint page which will allow the team to grab that .exe from the page and run it from there. And therefore once a new version comes out, we can just replace the old version with the new on SharePoint.
Is there a way to do this or would my best bet be using something like Java WebStart?
Although Java WebStart sounds like a reasonable solution here (you will require every user to have the appropriate JRE), does the app have to be distributed locally ? Can't you put a web interface over it ? That would mean you'd run and adminsiter a server centrally, and you wouldn't have to worry abput distrbuting the application and/or the JRE.
If you've got a standalone app that can't be embedded within a Java EE server, you can embed a web server (e.g. Jetty) within your app and have that server up the necessary web pages.
I am looking to start a java web applet, as I need something that doesn't need downloaded (saved to computer) and for the most part will work for Windows and OSX.
I have never done anything with java, so my question is can you do everything you can do with a normal java jar file on the web?
More specifically, can you write a web applet that detect window titles (Like the title of an active window), running processes, look in the windows registry, or find hard drive serial numbers?
The applet needs special permissions for these type of actions. It needs to be signed and trusted by the user.
Have you considered using Java Web start? If the communication with the browser from which the applet is run is crucial, then applets are probably the way to go. Otherwise Java Web start is preferred as you'll face less compatibility problems with browsers' Java plugins and different JVM versions.
Yes, but your applets must be trusted by user (user change some browser security settings)