I have a Java desktop application and now we distribute it as a jar in a installer of a main application (currently the Java application is only an importer/exporter). But as the jar is updated more often than the main application we are thinking of making it run through Java Web Start so it's updated independently when it start.
My question is how can I distribute it in the installer so if the user don't have internet it use the jar bundle in the installer (and copied in the main application folder) but when he launch and have internet, Java Web Start update it?
Edit: I have think in making two JNLP files one for local launch and one for online launch so it get updated, but then they need to share the cached jar so isn't installed two times, and I don't know if this is possible.
Edit, more explanations:
Maybe I haven't explain it very well. I have a native application and is distributed as an MSI, from download and through CD. With this application we distribute the Java application (a jar) that the main application used to exchange data to other formats. The MSI installs both the native app and copy the jar (not really install). Now if the user have internet and a new update is published, the complete MSI is downloaded and installed (updating the installation). Ok?
Well, we like to update only the jar in a more fashion approach, with Java Web Start, so it's updated when the jar is run independently of the main app. This have the problem that if we only deploy it as Java Web Start, if the user install the app in a computer without internet (for example carrying the MSI in a pen-drive or cd) he will not be able to use it, because as he don't have internet he can't download the jar.
And now is when my question come, can I deploy the jar in the MSI but execute through a Java Web Start so if the user have internet it get updated but if he doesn't have internet it still can use the bundle jar in the MSI?
..can I deploy the jar in the MSI but execute through a Java Web Start so if the user have internet it get updated but if he doesn't have internet it still can use the bundle jar in the MSI?
OK, I am formulating a plan here, this might be doable.
Let us presume that the MSI is capable of doing the following things.
Install a JRE if missing or too low a version available. The JRE needs to be included in the MSI (to avoid requiring the net).
Unpack the JWS launch file and Jar(s) (and native..) to the local file system as temporary files.
Invoke the javaws tool using 'IMPORT-OPTIONS' to set the code-base to the place in the local file-system they were unpacked.
At this point, desktop icons and shortcuts should be installed, and the program ready to launch. It is vital to specify a few extra options in the JNLP - specifically offline-allowed to ensure the app. can still be launched if the internet is not available.
Caveats: I don't have any experience with MSI, and my experience with using the import options is limited to calling them from build files (during development).
Related
I have a webstart application that uses ProcessBuilder to launch several other application jars from the main app. The whole purpose of the main app is to kick off these two other apps. I am certain the jars are all making it over webstart (no missing cache elements from the console when it launches) but when I try to launch the application jars, they don't seem to launch or run or anything. No exceptions either. I am able to run the app locally when double clicking the jnlp locally but when I do it over the server it doesn't work and gives no signs of why.
My best guess is that it can't find the jars from the path name given over webstart when they are loaded in as java JAR resources in the cache, though I'm not really sure how to deal with it or reference them to start those secondary JAR Apps.
I am creating a GWT application in Eclipse. For the application to work, it needs to be deployed on a server that runs on my virtual machine. It uses our company's JS library, that only works in this specific environment, so I really need to compile the GWT app and deploy it to the server.
The app basically consists of following folders and files:
/war
---/images
---/resources
------/localization
------/mapdata
------/svgs
------/etc...
---/gwt-compiled-app-folder
---/index.html
I know I can have images and languages inside the GWT app but we do not want that as we may change some texts or images without the need for compilation in the future when the app will be finished.
So far my build and deploy cycle is:
Click GWT compile in Eclipse and compile the app.
In WinSCP manually copy the compiled folder of the app to the virtual machine server root.
If any other resource changes (images, localization, vector map data, json resources...) I also have to manually copy them to the virtual machine.
Since I do this like 200 times a day, I'm getting tired of it and I finally have time to improve it.
My question is how can I automate these steps? What tools should I use? I do not even know if the app can be somehow compiled from command line. Ideally I would like to run some command or file that will compile the app and deploy all the files (maybe only those that has changed or are different) to the virtual machine.
EDIT:
I finally got build by maven to work! So now I only need to know how to copy the files to the ftp.
I am developing desktop database application. Using rdlc report and reportviewer. Everything was fine in developing process, reportviewer was showing all data smoothly. I deploy app with Inno Setup. But when I install the app, the reportviewer is not showing data. While data is correctly inserted in the tables.
For applications that work incorrectly or fail completely, when installed by Inno Setup to Program Files folder, the first thing to test, is to try to deploy the application manually to the same folder.
If the application fails even after a manual deployment, the most usual problem is that the application requires a user to have write permissions to application folder. As on modern versions of Windows a user typically does not have write permissions to the Program Files folder, the application does not work. So the problem usually has nothing to do with Inno Setup, but it's a problem of the application itself.
To solve the problem:
The best solution is to redesign the application so that it does not require write permissions to its folder. Windows applications should not require write permissions to their folder. That's against Windows guidelines. The application should write data to a user profile folder (C:\Users\username\AppData) or to a common data folder (C:\ProgramData).
A dirty workaround is have the installer grant a user(s) write permissions to the installation folder. Do that only, if you cannot get the application fixed (e.g. it's 3rd party application).
See Inno Setup - How to set permissions of installation folder.
Even more gross workaround is to configure the application to be executed with elevated (Administrator) privileges.
See Inno Setup desktop shortcut (link) which has "Run as administrator" advanced property set
or How to set 'Run as administrator' on a file using Inno Setup.
Another solution is enabling legacy compatibility mode that makes Windows redirect all application write attempts to a virtual store. See also Application installed with Inno Setup writes files to unknown location instead of its installation folder.
There are numerous other possible reasons, why the application might be failing when installed, including:
You omitted some dependency:
DLL library
.NET assembly
.NET Framework
Java Runtime Environment
other runtime
COM/ActiveX object, etc.
The application requires some configuration:
a file
a registry key [including COM/ActiveX object registration]
an environment variable, etc.
The application is not designed to be executed from a folder that has a space in its name (Program Files).
The application gets confused by Windows File virtualization (though it's unlikely). See Application installed with Inno Setup writes files to unknown location instead of its installation folder.
I read some comments about the build of dropwizard applications: [1] "Dropwizard is designed to run as a JAR, not as a WAR file." and [2]"You can't do this. Dropwizard embeds Jetty. You should look into just using Jersey as a standard web application.", so, my questions are:
1 - How to deploy a jar file in a production environment?
2 - How will I manage the service? for example, is there a way to monitor the healthy of the application? if the application falls down how can I restart it again automatically?
[1] How to create a war from dropwizard app?
[2] Dropwizard in tomcat container
You can use tools like runit or systemd to manage your dropwizard app on Linux. They can do things like make sure it starts when the system starts up, and can help with detecting failures. There is a bit of scripting involved.
You can point a monitoring tool at the healthcheck URL of your app to send alerts when it's down.
For deployment, I prefer to package apps using the system packaging format, .deb (Debian-based systems, including Ubuntu), or .rpm (RedHat based systems). Use the fpm package builder to create it, and include your runit files (or whatever), and scripts to copy the jar file somewhere on the target system. If you have a private package repository, you can put builds of your app into it, and installation becomes a matter of "apt-get install myapp" or "yum install myapp". Otherwise, drop the package onto your target server and run "rpm -i myapp.rpm" or similar.
After running mvn package of your source directory, the said jar file is created in the target directory by maven.
Just upload this jar file to a directory of your liking on the server, say /opt/myapplication/.
The jar file can be executed on the server with java -jar JARFILE, make sure you have java installed there. That's it, basically.
Now when you run this in production, you want to have the process supervised (and restarted if it fails) and started automatically on bootup. For this, look into your servers startup-system (systemd was mentioned before for those linux distributions that support it, but on current debian/ubuntu versions you have ATM still other boot mechanisms, you probably need to write a start script for /etc/init.d/myapplication).
Health checks are - as mentioned before - integrated in the dropwizard app, you simply request the health check url on a regular base. In professional environments, you should have a tool like nagios that you could point to the URL.
If your server is unix, you can build fpm packages to install your service on server. Just build fpm, copy to server and install it.
Or use fabric (http://www.fabfile.org/).
We currently have an Java application that can be deployed on clients or run as a shortcut from the server. We have intermittently received ClassNotFound exceptions when running the JAR from the server which looks like Windows dropping the network connection with only part of the classes from the JAR loaded (user opens a different screen then the problem is apparent).
I am currently looking at the Web Start technology to allow us to run a single shortcut.
However the application has several folders it requires to be in the same folder the JAR is launched (for configuration, logs, etc.). These folders will require full access for all users to allow them to write log files. There are lots of configuration files under the configuration folder hierarchy.
The application also requires access to environment user settings (such as getting their user folder). It also requires certain command line parameters (including which folder to use for configuration, log file location, java memory usage, etc.)
Edit
The application also contains a reference to 2 signed JARs. These are:
jh.jar
mail.jar
It looks like these are signed by SUN Microsystems. jh is used for help integration in our application whilst mail is used for email integration.
I have now downloaded the latest versions of these files from java2s.com which do not have the signed equivalents.
end edit
The application is developed in Netbeans which compiles a single JAR file and copies the dependant JARs to the dist/lib folder. I enabled the Web Start functionality in Netbeans for the application and it generates the JNLP file.
Bearing everything in mind is Web Start the way to go for an application like this?
Can you include folders in a Web Start deployment? I could not find anything to do this in the XML structure for a JNLP file.
Cheers,
Andez
Yes, you could use WebStart for this.
Permission:
If you need permission to the file system, you have to sign your jars and put the all-permissions tag in your jnlp.
Arguments:
Arguments can be provided by using the arguments elements in application_desc.
Folders:
I'm don't think you can include folders in the WebStart application, but you could put the config files in a jar and read them from there, or extract them on startup.
ClassNotFoundError:
We have intermittently received
ClassNotFound exceptions when running
the JAR from the server which looks
like Windows dropping the network
connection with only part of the
classes from the JAR loaded
Does not sound plausible to me. per default, all jars will be downloaded before the application starts. If you set "download" to "lazy", the jar will be downloaded when first needed, but I would guess it will be downloaded completly then.
You can provide read-only resources for Java WebStart. Getting the log back is harder. I would suggest looking into a centralized logging solution, using one of the standard appenders in the log framework you use.
For a Java Web Start application it is always advised not to create files or folders in the class path. Recommend user's home directory to store your settings or database files.