Silverlight / Java Applet equivalent? - java

My society was hit in the face with the NPAPI deprecation in the google browser.
We were using Silverlight for a long time and we are curently looking for any replacement solution.
What was good about applets and silverlight was the easiness for the applications to access the file system and get the rights to automatically save anything into the computer.
Beside it was compatible with the major OS and almost all Browsers, which was a great thing for our customers.
But chrome decided that NPAPI causes too much security problem, and they will remove it by september.
I'm looking for a simple way to provide access, at least to the file system of the customer.
asp.NET gives us anything we need, on the server side, but it can't do a thing on the client side. With silverlight we were able to use the clipboard,save multiples files on specific directory, send mails from the client etc.
I thought about making our own plugin on several OS, but that would be a lot of work. So i was wondering if there were a simple compatible solution that already exists.

You could build a FireBreath2 plugin to provide this functionality -- FireBreath2 will work on chrome w/ native messaging, and the functionality you describe shouldn't be too hard to do cross-platform. Keep in mind that you've got some serious security risks to protect against, though.
FireBreath2 as of this writing isn't quite production ready, but it's pretty close. ActiveX support isn't complete yet, but it shouldn't take that much work to finish it. It would require a good understanding of C++ and a willingness to help with the project since it's not 100% ready for prime time yet.

Related

Java single code base for desktop and mobile

Is there one or several java based technology that can help me write an application code base once (including Logic-Views-Controllers) and then compile and run it for
all platforms including main desktop and mobile operating systems as well as
in the browser. It must work and save in offline mode too so that it could sync with remote server as soon as it is connected to the internet. To me, it seems there must be a way if I use some sort of html/css/js technology to handle my views for such an application since I don't need fancy operating system dependent view technologies, and java for Logic and controllers. So far I have found Oracle ADF Mobile which seems to be commercial, eclipse RAP, eclipse scout .... But I look for something that covers Desktop as well. In addition if I can make the application run only in web browser, in case it would run and save in offline mode, it would be fine enough for me.
You could use Eclipse Scout for this with the following setup/limitations:
Since June 2016 Scout only supports web UIs (until 2015 Scout also had support for Swing/SWT, but this is gone now)
You would need to run the Scout frontend model part in a local Tomcat
or similar
You would need to add the sync code for connecting the Scout frontend
model with the Scout backend (that would sync data once a client installation gets online)
Asking for a mobile solution in combination with Java will most likely put you in a messy situation, especially with the discontinuation of RoboVM
Hint: The Scout team has started working on JS offline capability of the Scout UI. However, this is effort is still many months away from production quality (many parts/concepts still missing, not all parts open source, no documentation, etc.)
Addition: You will have the same limitations with Eclipse RAP (needs a frontend server, only web based, hint: styling rap apps is hard).
Looking for the silver bullet... Beware that "not caring about something" (the OS) will make you care a lot about a framework that does the "dirty work".
Leaving opinions aside, in 2016 you will reach your goal quicker with JavaScript, it has become the only thing supported everywhere.
It may be a good deal if you're OK with JS, and living on the bleeding edge with heterogeneous / less mature tooling (see NPM gate).
Java in the browser (applets) is dying soon due to its well documented security issues. One could argue it's been dead for a long time.
If you do want to code in Java only, GWT is still alive. It compiles your Java code into highly efficient JavaScript.
However, ever since Google reduced its involvement by giving away the project to a steering committee, the developments have slowed down drastically, and I'm not even sure they are up to date with JDK 8 yet.
Google still uses GWT in projects like inbox, for what it's worth.
I would go with GWT.
Google also uses this for projects like the inbox webapp, and the inbox android app. Using GWT a lot of code between the two apps can be shared.
It is also possible to compile as a windows desktop application.

Java applets are no longer supported - what's the alternative? (File manipulation - shell commands)

I have a question about how to manipulate files from the browser, currently we are using a java applet. To create some folders, replace/delete save some files/folders and execute a shell command with parameters. As we know Chrome no longer supports the npapi and therefor java applets, FireFox will soon follow and my guess is that IE will not stay behind forever.
So the actual question is what's the best way to go?
Should we think about creating plugins (but this then should be done for all major browsers - a lot of work)
Or do you recommend to install an external program, what we can launch on the users system? By for instance associating a specific extension, or by adding a url scheme?
What about this Java Web Start? Does this allow us to communicate with the domino api?
Any other technologies that would be better?
The website we are building is using IBM Domino 9.0.1 XPages (JSF).
Answering to your use case: content management system.
For adding files the HTML5 files API should do all you need. There are plenty of examples including multi file uploads.
It gets trickier when you want to provide a round-trip edit experience. Like you click something and Word, Excel, Impress, Photoshop opens and you edit. When you save it all goes back to Domino.
The solution here is wevDAV. You can even expose Domino views as folders in Explorer / Finder / Nautilus.
For Domino there is a project on OpenNTF that implements WebDAV for documents/attachments on Domino (I wrote it). It might be your best bet.
I think we should be making a distinction here:
things like file access can be done using HTML5 file access, but
things like local administration definitely aren't something that need or should be done from within the browser.
In fact, I always hated that Java suggested that users "need not install any software" to do this and that on their machine, which was a straight lie, considering they downloaded Java Software, had to tell their Java Policy framework to trust that and then that software was able to make local changes. That's just as unsecure as downloading any (signed) executable and making your user execute it.
Java's portability¹ doesn't apply to your use case, as it seems; "executing a shell command" sounds as non-portable as it gets. So, in the end, you either only have one platform you address, or one solution for every platform, in which case you gain no portability by the fact that the same Java executable can run on all JREs (given that's the case, even).
I'd say: It's a good time to let Java for Desktops die, especially since you don't seem to be doing anything that Java is good at² in your application.
As it sounds, the average installer framework can do what you want without you writing any code. There's plenty out there, especially for Windows, which you seem to be addressing; take microsoft's .MSI as an example. You'd end up with a two click, signable, trustable, updateable solution that wouldn't need the user to keep a JRE installed or secure at all.
CLARIFICATION: I really don't hate Java; I don't find it's the greatest language or has the best ecosystem, but whatever makes your application work is fine.
Now, you mention:
To be clear, we are creating a Document Managing System, which used to be on the Lotus Notes client and that we are trying to port to the Web.
That does in fact sound like it might be a good idea to chose any browser and embed that. In fact, Firefox is "merely" an application around a browser core, and you might just modify it (e.g. by writing an extension) to fit your needs. It's not really a "web application", that way, but it would meet your requirements of integration with a web application and local administrative access. I furthermore recommend thinking twice about the shell scripts you need to run locally -- maybe their job can be more easily replaced by another program or even something that is "web compatible" than calling them with local privileges from your web application.
¹ (which was a big thing back in the day, but honestly, Java applications nowadays are about as portable as your average .Net or Qt based application on desktop OSes, but never quite feel completely like home -- it's like portabilities ugly sister if you're portable, but only offer the minimal common subset of functionality and look and feel on each platform)
² ... whatever that might be!

Which option is suitable to replace Java Applet?

I would like to replace Java Applet which currently needs to use client's resources, i.e. external readers, and to communicate with a server via socket.
Reason:
1. I have thousands of client machines using this Java Applet program, and most of them are running out-dated JRE. When the Java Applet program is updated / added new features, all client machines will need updating the latest JRE.
Expected Solution:
The Java Applet program would be expected to be replaced by a web-based application, which allows to compile and run source code at client's side such that the new web-based application could still use client's resources and communicate with server via socket.
Can I use JavaScript to achieve it?
I would very appreciate your help/suggestion for this problem. Thank you!
JavaScript is a scripting language that gets evaluated in the browser.
I would not describe it as compiling and running but yes, it does mean you can run code in the client and is commonly used to create applications that run in the browser.
There's a staggering amount of frameworks that you can use to write your application. Take a look at the TodoMVC site to see the same TODO app created using several different frameworks.
If you come from Java applets, GWT may be interesting to look at.
If you wish to let the JavaScript client listen for messages from the server, take a look at websockets.
The smart card reader is going to be a problem, though!
See Architectures to access Smart Card from a generic browser? Or: How to bridge the gap from browser to PC/SC stack?
By the way:
The real issue with outdated JREs is not that your code will not run on old JREs, you can create perfectly fine applets using java 1.4 or java 5. Any libraries you may need you can deploy alongside your applet. The pain is a security problem. Anything but the latest version Java plugin is getting actively exploited and puts the user at risk. Occasionally, even the latest version is not safe.
try socket.io
I think this is the latest technology you can use to communicate with client browsers. it support the latest browsers and mobile browsers too.
hope this will help you.
Javascript has become very powerful with HTML 5.0. Here is a list of new elements that you can use to access all kinds of resources, including local files, audio, video, GPU rendering (canvas + WebGL) and GPU compute (WebCL). Here are even more things you can do, including database connections and networking. You can even create offline Javascript applications.
jQuery and jQuery layout make robust GUI development a lot easier. Rich tool suites, such as Google Closure offer optimization and a compiler for improving performance and detecting obvious mistakes early in the development process.
W3 offers useful stats for making an informed decision on how many users on average have access to which features. Note that the most annoying guy in that list arguably is IE8 due to it's lack of proper HTML 5.0 support.
In case you want to stick with Java, then one alternative would be to use my http://bck2brwsr.apidesign.org project. It's goal is to create small Java that can run in 100% of modern browsers without any plugin installed.
There are Java bindings to HTML (via knockout - one of the four most popular frameworks for HTML5) and that is why one can code whole business logic in Java and just render it via HTML. Should be enough to replace most of the applet UI.
In addition to that there is an experimental API to render on HTML canvas. People use it to write Java games that run in a pure browser.
There is a simple way to communicate with server via JSON REST API or via WebSockets. A live example is here.

Possible to check for files on users computer from website?

I know this question brings up a lot of security issues, but is it possible to check for files on a user's HD from a website? We have a software application and would like to be able to check for certain files-types on the user's cpu before they download our software.
Again, I realize this is intrusive and a security issue but wanted to ask anyway. If this is possible, would it be done with some type of Java or ActiveX control?
I would appreciate anyone pointing us in the right direction.
thx!
I suppose using either Java or ActiveX would work, but only where Java or ActiveX exist. Obviously, users of browsers other then IE don't get ActiveX, and I'm not sure the penetration of Java, or Java Webstart installs. I'm sure its not anywhere near everyone.
If your goal is to validate a system before installing some complex software with dependencies, I would suggest having a separate package that just does the validation. Especially if it is just a single .exe (not requiring installation), spending 30 seconds doing this in prep for some complex download, install, reboot, fail cycle seems like a good tradeoff.
It can be done with an ActiveX control. The user would, of course, be prompted for permission for this, but since sites like Panda Security can do a virus check via an ActiveX control, then it's definitely possibe to write one to list the files on a HD.
I'm not sure if the Java Sandbox will allow this, so I'll defer the question of doing this via a Java Applet to REAL Java developers. (I haven't been a Java developer since 1.14, and I was never any good at it.)
Java Web start can do this with the proper settings http://www.ibm.com/developerworks/java/library/j-webstart/

Is it worth studying applet?

I am a fresher in web developing , is I ve to study applets?
If you are a Java person, maybe look at JavaFX instead (even though it is not clear yet if that technology will take off any more than applets did).
If you are a web design person, do not even think about it before you got acquainted with Flash and HTML5. Applets are quite marginal at this point.
Most folks say no, but I still see a lot of great uses for Applets and in fact have seen really complex commercial UIs coded within the context of an applet.
in a short word, no, applets are a dead technology for the general purpose web.
on intranets with lots of bandwith and controlled client environments they maybe of some valid use.
look at Google Web Toolkit (GWT) as an alternative to creating applets.
Adobe Flex is also a good alternative now.
If you want an embedded client application, the Java Web Start (the better Google keyword is JNLP) is less or more the successor of the legacy Java Applet. Alternatives to this are Adobe Flash and MS ClickOnce.
If you want an RIA (Rich Internet Application), then JavaFX is the better Java based choice. Alternatives to this are the MS SilverLight, Adobe Air and Adobe Flex.
Apart from JavaFX, Flash, you can learn about Adobe AIR and Microsoft Silverlight. They are kind of extending the limits of what was earlier possible with just Flash
There is still one thing that I know of that a Java applet can do and Silverlight, Flex (non-AIR), etc can't do:
Drag and drop from the filesystem.
Flex offers a o/s based browse and select filesystem access. Silverlight has a similar functionality. But to the best of my knowledge if you want the user to drag a file from Windows Explorer etc. into a web-site based control, Java applets are pretty much your only choice. You could create a Flex based app using Adobe AIR that can ask the filesystem outside the o/s browse and select dialog but I'm not convinced the AIR install base is adequate yet. Probably depends on your target customer (early adopter, install whatever you say to vs. stable corporate user with IT lockdown on their workstation).
If someone knows otherwise for certain, please comment!
But to answer the original question, unless you need the drag and drop filesystem to web functionality, I would spend your time on Flex. Silverlight and Java FX can't compete with Flash for market penetration. Since Flex compiles to flash, it has a very high install base (>95% of internet enabled computers) and its base updates to the newest version frequently. Inserting a flash file into a browser is a easier than the arcane art of applets.
if you want/might get a job where you maintain old applications then probably you will deal with Applets.
For new projects, dont get close to it.

Categories