How to setup Connectivity between the web component and java app - java

I am confused about the approach for application that am writing. I have developed the application jar and will be distributing via java webstart.
Now i need to putup a website supporting my app.
doubts i have
1)Can i pass this username and password to the jar that i will be launching?
2)Can the webcomponent calculate the time for which the app was launched.
Basically i need to understand how will the webcomponents and my java app interact with each other in terms of any data required to pass to the app and any info retreaving from the app and putting on the web.
Thanks
Krisp
I want to pass arguments like username to the JNLP and then want to pass it to the main class.
Is there any direct way to do so rather than use database?
since JNLP is just an xml file. I could not find a direct way to do so.
Can i anybody refer me some working code example.

Database is probably your best bet for sharing data between both apps. Other options are web services, sockets, RMI, etc.. You will probably need to look into all, on the surface initially, to know what suits you best.

As for the Calculation of the time in my java app i can use currentTimeMillis() to calculate the time for which my app is running.
But senarios like app getting crashed or forced termination of the app it will not get saved.
Any Hints for communication in terms of data between the web and Application jar?
Thanks
Krisp

Related

Java Desktop app with webview UI

I want some way of creating a dedicated browser window for a browser (chrom-e/ium or firefox). Its content needs to be controlled by a java application (a http call to localhost or better a more direct way of communicating). These two should be bundled together in some way.
A little Background
I want to write a java desktop app but don't want to use Swing or javaFX for the UI. The UI should be written like a one page app and may be ported (at least partially) to the web. I have taken a look at the javafx WebView but would rather have a full fledged browser on my hands. It would also be nice to have a little more control over said browser to send files and read files in a more desktopish way. The only real requirement is that there has to be some java backend behind it and that is has to work offline.
Is something like this possible at all or is it just a pipe dream?
I am very almost a year late for the party, but:
There are a few (that I know) technologies that can help you:
Electron. It is basically what you want, you can use web
technologies to "forge" a desktop app, it's quite well known, I never used it but for what I have read that you can stick almost anything to it's "backend".
JavaFxWebView. There are some really nice ways to use it, you can
even use bootstrap and AngularJs, here is a example (not by me)
Yes it's possible and not all that unusual. Your app can open a default browser as described here -
https://stackoverflow.com/a/10967469/5087125
And then proceed to respond to http requests to your app.

deploying a java SE application in Netbeans8

I have built a GUI application in Java using Netbeans 8.0 and have linked it to a MySQL database on my system using JDBC.
This application provides login functionality to its users and lets them take a survey.
My problem is to host this application on the internet and collect the data filled by users in MySQL database.
Can someone please suggest how to go about this??
I am a newbie and have tried using java web start to make this work.But no success yet.Please suggest how should I go about this.I'm saturated with all the googling.
I don't get what your problem is. Normally a GUI application is a program which can run on a desktop machine. If I understood well, you want to create something which connects to a remote database. You can do this with your application but you need to distribuite it along the users. If you want to run a java code on host so that people can use it in internet like a webpage you need one of these:
applets
a webserver capable which can run java and jsp/jsf or whatever
If you can be more specific I can help you in a better way.
Cheers

java google appspot application can I move to another server?

Its possible to move my app hosted in appspot.com to another server.
If so what are the steps and requirements?
My app its done in eclipse using gae java
Thanks in advance!
It's not possible to take your code exactly as it is now, set it up in a different server and work. Even if your whole code is App Engine agnostic, your datastore models are probably not. Thus, first you need to define which is the development environment you want to move to, and then modify your code to properly work on that.
As far as your current data are concerned, you need to create a "migration tool" that will get the data from App Engine and import them to your new environment.
Hope this helps.
Google Appengine doesn't provide any controls over what host(s) your code runs on. If you've set up a paid app, you can change the memory/cpu profile on the Application Settings which could be assumed to require an instance of your app to run in a different virtual machine. You can also shutdown an instance (on the Instances page). If there are no instances running, a new one will be created on the next request, and is unlikely to run on the same virtual machine as the one that was running the app before.

Run remote app but not the entire desktop

In the company where I work we have, among others, an application made in Java running on two places (let's say Merida and Coatza) and both have different databases. The users from Merida only occasionally used the program to get some info or capture things. Now the company owner decided to control almost everything from Merida but we cant get the databases merged due to operation logistic.
The thing is that when the application uses the persistence-unit to connect coatza it's incredibly slow since the app its not prepared to use remote databases (at least not with a high performance).
I thought of something like teamviewer to run the app remotely but not the database, however I don't want to run the complete desktop, only the application. Or develop a part of the program on JCurses so it can be run from coatza but there is not enough documentation and we use a lot of tablemodels.
Is there something I could do?
The application is a DesktopApp. We use Jboss 5 as server. Hibernate and JPA.
I had a similar situation where we needed to use the same application at different locations because the license was too expensive. I used a feature called RemoteApp on Windows Server 2008. The best part is that you can have a desktop shortcut for any app on a remote computer and all you need to do is open it and login and only that particular app starts running instead of the whole desktop. There is also a web interface for remoteapp so that you can simply login and select whichever app you want to run. For more details take a look at http://www.techotopia.com/index.php/Configuring_RemoteApps_on_Windows_Server_2008

web-browser based GUI

I am working on an application in Linux which will interfaces with hardware. One of the requirements is to create the GUI in Web-browser . the application will be c++ based. I m not familiar with web realted stuff so i want to know Is it possible to do such a thing (currently it's a console application take input from txt file/cmd line). gui will be simple using button and showing output messages on browser from the application. i want to know which technologies/languages are involved and how can it be done. some of the idea i read but havn't found anything concrete yet. if u have any idea about these or a better suggestion please share
run the app in background and communicate with browser ?
call library functions directly from browser ?
any other idea ?
I would start by setting up a regular HTTP server, like lighttp or Apache httpd.
You say you already have a command line program that does the actual work - As a first step, I would reuse that, and configure the web server to call your program using CGI - see forexample http://httpd.apache.org/docs/2.2/howto/cgi.html for apache
Finally, I'd pick some javascript framework like jQuery or YUI with Ajax capabilities to do requests to the server to call the CGI script from within a webpage. You could also create a form-based web application without ajax or any framework, but that would require you to stuff all kinds of logic in your program to generate HTML pages. By using Ajax, you can leave the command line application as is, and parse any responses it gives with javascript, and then use that to dynamically change the webpage in a way that would make sense to the user.
If this all works, then I would try to figure out how to package all these components. Perhaps you just want to create a simple archive with all the programs inside, or maybe you want to go as far as actually embedding the webserver in your program. Alternatively, you may want to do it the other way around and rewrite your program as an ISAPI module that you can plug into your webserver. Or if that's not integrated enough still you could write your own (partial) HTTP server. That's really up to you (I'd probably spend time and energy on searching for the leanest, meanest existing open source http serverr and use that instead)
At any rate, the prior steps won't be lost work. Most likely, developing the web page is going form a substantial part of the work, so I would probably create a quick and dirty working solution first using the age-old CGI trick, and then develop the webpage to my satisfaction. At that point you can already have an acceptable distributable solution by simply putting all programs in a single archive (of course you would have to tweak the webserver's configuration too, like changing the default port so it won't interfere with existing webservers.) Only after that I would spend time on creating a more integrated fancy solution.
I ended up using Wt though I'd update for future reference.
These are how I thought of doing this, in order of complexity for me:
Create a simple server-side-language (PHP/Python) website that can communicate with (ie launch and process the return of) your application
Modify your application to have a built-in webserver that just punched out HTML (command line parameters taken through the URL)
Modify the app to publish JSON and use javascript on a simple HTML page to pull it in.
You could write a Java applet (as you've tagged this thread) but I think you'd be wasting time. This can be quite simple if you're willing to spend 10 minutes looking up a few simple commands.
After 12 years, web browser-based GUI started to appear, WebUI is one of them.

Categories