How to bundle jre with .exe file created from .jar - swing

I created .exe file from .jar file .Now my client demands to run the application without installing jre in the sytem.I have heard that with bundled jre it is possible ...but i dont know how to bundle jre with .exe file..

The JavaFX is working on this. Here are the up-coming features in Java SE 7 u10:
https://blogs.oracle.com/talkingjavadeployment/entry/packaging_improvements_in_jdk_7#3
https://blogs.oracle.com/talkingjavadeployment/entry/packaging_improvements_in_jdk_7

I have used VMware ThinApp to do exactly what you are trying to do. It does cost money, but works extremely well. It allows you to roll up all the dependencies your application uses into a single executable that can then run on vanilla installations of Windows. It can be used for a lot more than just Java, and it does so by recording the changes you make to a system after installing your application + the JRE for example, and then wraps up all of those changes. It certainly simplifies application deployment, since the applications are now portable. I've even used it to roll up Visual C++ redistributables, and .NET as well. This certainly increases the size of the executable, but it's also convenient knowing the application will run successfully. See more info at http://www.vmware.com/products/thinapp/overview.html.

The open source Launch4j allows you to produce an exe with an embedded JRE. This SO article also discusses this topic. Caveat: I've had very good success with Launch4j, but never used the embedded JRE feature.

Related

Compiling sqlite-winrt for using SQL in WinRT/WP app with SQLite

I'm trying to use the sqlite-winrt library at https://sqlwinrt.codeplex.com (cf. http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/05/30/sqlite-winrt-wrapper-for-windows-phone.aspx) because I need to access an SQLite database via SQL commands in a WinRT 8.1 and a WP8 app and this library seems the only available option.
Anyway, there is no binary release and if I try compiling the source I get several link errors for unresolved externals against the SQLite DLL. I posted an issue at codeplex but got no reply yet, so I was wondering if anyone had already managed to successfully compile this lib and how (or if you know of any viable alternative for RT8.1 and WP8). Here is what I did:
downloaded the latest source from the site.
downloaded and installed 2 VSIX from http://www.sqlite.org/download.html: sqlite-winrt81-3080002.vsix for RT 8.1 and sqlite-wp80-winrt-3080100.vsix for WP.
executed the powershell scripts in each subfolder of the source code solution, which are required to update the projects with newer releases of the SQLite for WinRT extension. The current versions of the scripts refer to SQLite for WinRT 8.1 (prerelease) which is the same I downloaded above.
opened the VS2013 solution and removed the RT project (I just need RT8.1 and WP, this was for WinRT 8.0).
5) built the solution, which failed with link errors.
If I see the RT8.1 project properties, I can confirm the reference to SQLite is under C:\Program Files (x86)\Microsoft SDKs\Windows\v8.1\ExtensionSDKs\SQLite.WinRT81\3.8.0.2.
Did anyone manage to use this lib? Thanks!
I also once had that problem. I fix it by editing the project file manually. At that time, the powershell script updating the wrong path. That's why I always failed when compiling my project. After I edit the project file using external text editor (I use sublime text), the projects are linked correctly.
You can try DatabasesCx. It is another SQLite Wrapper using Windows Runtime Component technology. It is freeware distributed as precompiled binary. You can find the details at http://www.almanacsoft.com/databasescx

Using org.eclipse.core.resources with RAP

I am currently trying to port an Eclipse RCP plugin to RAP (it is my first experience with RAP). I had a look at several sample applications and tutorials on how to port, but all information I have got says that the bundle org.eclipse.core.resources should be available (as long as I don't misinterpret them completely).
I have resolved all other Required-Bundle-errors, but 'Bundle 'org.eclipse.core.resources' cannot be resolved' resides. It seems that org.eclipse.core.resources is not included with the RAP target platform (I installed it via Eclipse and checked the settings).
Is org.eclipse.core.resources not included anymore and if yes, what can I use to replace it? Or how can I include it?
The bundle org.eclipse.core.resources is not part of the RAP target platform, and it never was. The original bundle the Eclipse platform is not suitable for RAP.
To use the resources bundle with RAP, a RAP version would have to be created, that provides per-session workspaces in ResourcePlugin#getWorkspace(). It's technically feasible but probably a fair amount of work.

JavaFX Native libraries

I create a simple Java Map Scene in JavaFX. I put jfxrt.jar into my lib folder in project, but I also need native libraries to use some components: for example glass.dll on Windows and libglass.dylib on MacOsX. I have got few queston:
Where I should add these libliaries? To /rt/?
It is Swing application, and client start it by using Java WebStart. How can I add dependencies to these native libs?
What about x32 / x64 Windows versions? The jfxrt.jar is different for 32bit and 64bit system.
Where I should add these libliaries? To /rt/?
You could place the libraries in ../bin relative to where you have placed jfxrt.jar. Haven't tried it, but I think it will work as that is the directory structure used by the JavaFX distributions.
Embedding the native libs in a Swing app delivered via a webstart package is not a documented deployment option. Instead of doing that, I'd advise checking for JavaFX presence in your Swing app and, if JavaFX is not there launching a browser pointing to the JavaFX runtime download and installation page - the instructions for which are here. For example:
try {
new javafx.util.Pair("a","b"));
} catch (ClassNotFoundException e) {
java.awt.Desktop.getDesktop().browse(new URI("http://www.java.com/en/javafx/"));
}
It is Swing application, and client start it by using Java WebStart. How can I add dependencies to these native libs?
If you app is still in development, and can be targeted for the JavaFX 2.2 release in a couple of months, then you could set the minimum version required for the app to JDK7u6 - which will include JavaFX 2.2 runtime libs - then you wouldn't have to worry about their distribution and the deployment scenarios are much, much simpler.
Not sure if JavaFX 2.1 embedded in Swing deployed via WebStart is supported (or would even work) outside of Windows. You may want to wait for 2.2 for Mac and Linux webstart support for JavaFX applications.
What about x32 / x64 Windows versions? The jfxrt.jar is different for 32bit and 64bit system.
If you app is launched from a browser, then whatever bits the browser has is the bits that are required for JavaFX and Java. Most browsers today (at least under windows) are 32 bits, even if the user has a 64bit OS - so that is something to watch out for. As you are using WebStart, it may not have the browser bit match dependence (in which case you should at least match the bit versions of JavaFX and Java).

AIR file too big, breaks during installation

A client is having me convert an HTML5 video web application that I've already built into an AIR app.
The end users are going to need this to work with no internet access, so I MUST include a LOT of video files with the installer. This works fine on my machine, but my client can't install it because the .air file is too large and they don't have enough RAM. We'll need this installed on a number of laptops that aren't super powerful.
My SDK is up to date and we're using AIR 3.1.
Has anyone else run into a similar situation? Is there any workaround? For instance could I either include both the installer and the .air in a zipped folder, then have the installer move the video files to the appropriate location, or use AS to have the installer download the files (they will have internet access when installing).
I'd recommend you not to include heavy video files into your application. Downloading assets from web is a descent idea, I use same technique for several museum touchscreen apps.
So here's workflow: on startup app tries to connect to "assets server" and request list of files to download. It can be list of all the files, or list of files that have been updated/added since timestamp that you pass with your request. Then you download them to File.applicationStorageDirectory. Not to have mess in that directory I put all of them to "cache" subdirectory.
In case there's no internet connection for some reason when you install that app, you can have all that "cache" folder on your memory-stick/externalHD so you can manually perform that downloading process.
If you use Greensock's LoaderMax: I've written a simple URLStreamLoader that extends LoaderItem, handy for downloading files. Can share that.
The problem is quite obvious: the Adobe AIR provided installer for deploying your application is lacking.
However, Adobe recently released a new feature for deploying Adobe AIR apps: "runtime captive bundle" (Windows or OSX).
Which means 2 important things:
You receive an .exe which no longer requires an user to have Adobe AIR runtime installed (and no more incompatibilities when targeting multiple Adobe AIR runtimes).
You are no longer provided with an installer, and you have to find your own (which solves your problem halfway).
Target bundle when "compiling", and then just use a better installer (Windows or OSX) - think you are just deploying a normal application (worked for me:) ). There are too many installers arround to mention.
Your installer of choice + bundle compiling, together solve your offline installation requirement and the memory exhausting issue.
Packaging a captive runtime bundle for desktop computers

MySQL++ Application error at launch

I compiled MySQL++ with no issues. When I launched some of the executables (resetdb.exe and simple1.exe) they suggest to run to test if the installation has been successful, the first error I got was that libmysql.dll was missing.
Adding its path to the PATH environment variable did not fix the problem, even after launching a new command prompt; I had to copy the DLL in the directory where MySQL++ executables are.
Now the DLL is found, but I get this error:
simple1.exe - Application error
The application was unable to start correctly (0xc000007b).
Click OK to close the application.
even launching from the command line, I get no more information than these.
Thank you for any help!
MySQL 5.5 -
MySQL++ 3.0.9 -
Windows 7 64 bits -
MINGW32 -
GCC 4.4.0
0xC000007B is a Windows error that means the executable is corrupted. It could refer either to simple1.exe or to one of the DLLs it's linking against.
Some reasons this could happen:
You're mixing toolchains in an incompatible way. In your case, you may have built simple1.exe using pieces built by MinGW GCC and pieces built by Visual C++. MinGW should be compatible with any pure C DLL built by Visual C++, including the MySQL C API DLL. However, you may have other pieces interfering. MinGW isn't compatible with VC++ at the C++ level, but then, it shouldn't have linked at all if this were your problem.
You didn't follow the MySQL C API import library build steps in README-MinGW.txt. You either missed a step, or skipped it entirely and are trying to use the import library that shipped with MySQL.
In your previous gyrations, you ended up with a corrupt object file, which got linked in. Try saying make clean all at the top level of MySQL++ to force a complete rebuild.
You're mixing versions of MySQL or MySQL++. If you have more than one version of each on the system, make sure you're consistent in their use. That is, build the C API import library from the same DLL you run the programs against, use exrun.bat to run the examples to ensure you're using the just-built version of the MySQL++ DLL instead of another you have in your PATH, etc.
Additionally, I note that you're using an older version of MySQL++. If you were on Linux, I could understand that as some distributions still ship with 3.0.9. But since you have to build MySQL++ from source with MinGW, I don't see why you're not using 3.1.0. Did you get a binary build from somewhere?
As for your PATH problem, did you restart the MinGW shell after doing this? PATH updates don't affect running programs; they keep the value they saw when they started.