As node.js still lacks important functionality which exists in Java, I would like to use Java instead of node.js, and create the client using a web language (html, js, css..).
Electron is cross platform and so does java so it seems fit to have a solution getting the best of both worlds.
Does someone know of a way to integrate electron with java or have a different solution to the problem?
I made something similar, Java back-end with Electron GUI.
You can do it in more ways, it depends on what you need.
You can create a jar file and then execute it like terminal:
https://nodejs.org/api/child_process.html
Or you can open a socket communication and talk on a Port. (A lot of documentation:
Java (web)socket - Node.js client.io)
In this second way, you can do everything you want, but you have to create your communication protocol.
Your path is not foolish, I am very satisfied of the communication and usage in my work with Java + Electron .
I've created a small PoC where Java process is integrated with Electron front-end: https://github.com/jreznot/electron-java-app There you will find a simple TODO List application built with Vaadin/Jetty and Electron.
Personally i made my back-end java communicate with the front-end by creating a file with te data then sending it to the main.js to be processed.
DBus and winDbus seems to be an option here.
It creates nice abstraction and separation between "frontend" and backend
https://sourceforge.net/projects/windbus/
I'm going to test it on my own soon
Related
I have a .NET Core (console) app that I would like for a Java app to depend on. Essentially I would like to be able for the Java app to invoke a multi variable method in the .NET Core app and then pass the result back to the Java app. It would be nice if the .NET Core app could be embedded in the Java app. I have previously seen .NET Framework specific solutions to this problem, but since this would only be relevant on Windows, I would like a solution that also works on Linux.
In the past there were some technologies such as IKVM.NET and COM Interop wrappers but the former is defunct and the latter probably wouldn't work on Linux.
Since you own the .net core code, I would take a more modern microservice approach. I would design the .net core app to be a REST API running as a console app listening on a port. I'd have the Java application spin up the console app, invoke the methods passing JSON back and forth and then spit it down when complete.
From my actual knowledge this nuget package JCOBridge is able to do what you are asking for.
Until now it supports linux for x64 architecture.
I tried the templates available on Templates and them works on my Ubuntu 18.04. The same templates works on Windows.
Is there a modern way to run java application on the web? As far as I know, java applets and java web start both are deprecated.
I have an android app, written in java, which I want to run on server (of course, altered in some way). While java is cross-platform there is no problem to transfer it to desktop (no matter, javafx, swing or etc.).
Apparently, it would be great not to re-write it in some other language.
Nowadays, we're using GWT at work. Well.. It's efficient, it's fast and compatible with all browsers. And it's so easy to build a web page with GWT. You can check tutorials from this link.
And you can look up for Spring MVC. Not the most flexible choice for UI, I know. But give it a shot. link
But.. If you're open to new things, I'll totally recommend React Js. It's flexible,it's super fast with perfect UI. If you ever think of using Java just for back end, React js is a great deal for UI. link
There is an HelloWorld Example Java-Program which is running in a browser:
https://github.com/neo-expert/jsjvm_helloworld
After compiling you can just run the jar file which starts a webserver where the program will be served. (port 8080)
Can I write client side java in intelliJ, and then simply put it on a server for it to run on a server? Or will I need to write in a specialised version of Java and need to use a specialised IDE instead?
I'm trying to make an app and run the primary functions on a server then have the app send requests and fetch the data from the server. (It will esentially be a search engine of sorts and queries will be made to the server, which will then apply filters and use my algorithms to perform a search, before returning a result to the mobile device). But I'm not sure if I can begin writing this java on intellij, just as I would when making say, a simple calculator, or if I would need to write the java using a specialised server variation and server IDE.
Thank you.
The Java language is the same no matter what, so your logic can be ported easily. However on a server you may use a framework that's different from one you'd use on a client (for example you tagged this android- there wouldn't be Activities or Views on a server. You'd use another framework instead, possibly Spring.) Or you could go frameworkless, but then you'll have to write a lot of code that the frameworks do for you.
As for IDE- an IDE is an editor. You can write Java in notepad if you want. There's no difference, its just what features make your life easier. And yes, IntelliJ is a common choice.
If you would like make your own website, you should go with JavaEE or better with Spring.
If you would like to make simple server side application which will listen on specific port then respond something, go with Sockets
Netty is interesting NIO Socket library
I recently created an internal website for my company that launches client side applications. This website is suppose to be the central place from which users will launch all their business applciations. The reason it is a website is because is somewhat difficult to deploy applications to client workstations in our compnay due to packaging requirements, and also we want to make our client thin clients as much as possible. To achieve this what I have currently done is writen a website that laucnhes a ClickOnce application with some arguments passed to it via url. The argument basically provides the command for Process.Start.
As our company is primarily .net I chose ClickOnce however I also know that java webstart can do the same thing. Infact to me it seems to launch a bit faster as well.
Can anyone please provide some pros and cons between ClickOnce and Java webstart?
They are very similar and specular technologies...I think Microsoft has thought to JavaWebStart for ClickOnce tech. But you cannot compare them because ClickOnce is for .NET world while JavaWebStart is only for Java World.
So if your work is primarily based onto .NET, why do you have to evaluate JavaWebStart?
P.S. you know that you can use ClickOnce and JavaWebStart directly from a network share, I suppose...
I want to call Java from PHP 5.2, running either on a webserver or from a command line script.
From PHP 4, this seems to be simple, and just involves installing the PECL Java extension.
Example code from the PHP 4 extension:
<?php
// get instance of Java class java.lang.System in PHP
$system = new Java('java.lang.System');
// demonstrate property access
echo 'Java version=' . $system->getProperty('java.version') . '<br />';
?>
However, this extension doesn't exist on PHP 5.
What is the closest alternative for PHP 5?
edit:
Really I'm looking for an interface similar to either a C PHP extension or to that provided by the PHP 4 Java extension. The Java program is fairly small and only needs to retain a small amount of state between calls and doesn't need to run asynchronously. The PHP script would only be running a small number of instances simultaneously.
This would also need to be deployed to multiple machines (running Ubuntu 9.x and Debian Lenny), so it should be simple to install.
This project seems to be a good bet: http://php-java-bridge.sourceforge.net/pjb/
Since you want to keep state at the java site I'd either use a java process that listens on a plain socket or use a simple embedded webserver (winstone or jetty) if you are more fluent writing servlets. Some other possibilities are listed at this related question: What is the best approach for IPC between Java and C++?
Now quite what you asked for, but you could have a look at Caucho's Resin, and in particular their Quercus which is a 100% Java implementation of PHP, it allows integration of Java and PHP.
I have a project that uses a Java program to fetch some data. It's quite simple, but I found that
$java_command="cd /var/java_dir && java my_java_program $myparam1 $myparam2";
$result=exec($java_command,$output,$return_code);
works just fine.
Zend Server also has a built-in daemon allowing you to access Java functionality from within PHP. It works right out of the box.