I created a JavaFX application, For it I bundled it As a self-contained standalone application, using a private copy of Java Runtime.
But this became my application's size of 166MB, in which 146 Mb size is for jre.
How can I reduce the size of my application or can say size of bundle Runtime JRE?
I read somewhere that some files are optional in jre, So I tried to run my application after removing those files but unable to run the application.
So how can I remove the unused files/folders/modules from the Runtime JRE for my application ?
It is said that
Only a subset of Java Runtime is included by default. Some optional
and rarely used files are excluded to reduce the package size, such as
all executables. If you need something that is not included by
default, then you need to copy it in as a post-processing step.
So by default it is not adding all the files in jre, in that case my application is not running. Application.jar is working fine as it is using system jar.
So I add all the reamaining files in post-processing step.
Thanks
Project Jigsaw appears to have some hope for helping with this.
OpenJDK: Project Jigsaw
Why project Jigsaw?
But it looks to be coming in Java 9 at the earliest.
So as far as I can understand from your post, you can't run your app with the reduced JRE size that JavaFX provides. Additionally, you tried the steps detailed here and you still can't run your app.
Many apps can run just fine with the limited number of classes available in the JavaFX packaging of the JRE. Perhaps you can examine what Java libraries you are using which cause this issue. Then you could explore alternatives to those libraries. Finally you would need to test whether those alternative libraries are larger or smaller than the space reduction provided by the reduction in the JavaFX packaging.
If you are using JavaFX ant tasks to assemble you bundle, then just define the basedir attribute as an empty string in the platform element, like in this example:
<fx:platform basedir="">
<fx:jvmarg value="-Xmx768m" />
</fx:platform>
This will package your application and its dependencies but not the JRE itself.
Unfortunately, removing unused files is not possible with Java 8.
To reduce the Application Size you can use the native OS installers.
Windows Exe Installer should have size around 50 MB and the
Mac OS X DMG Installer around 60MB.
Related
Version 19.108
I'm getting this error when trying to install two customization projects. One project is extending a custom page in the other project. There are a few DLL's in play that are being referenced to call web API's. When I Google this error, I get hits for modifying the web.config but, I'm trying to install this in the cloud - acumatica.com
I've tried building all DLLs in x64 but, no dice.
I've got no problems on my local machine. This is only happening on a cloud install.
Any ideas?
TIA!
You might be mixing code that targets different platform (Mixed Platforms). Publishing one customization after the other can help (try both order). When publishing both at the same time it's possible that Any CPU chooses a default platform which isn't compatible with an assembly in the other customization.
Ideally all assemblies (DLL) included in the Files section of your customization project should target the same platform. It is preferred to choose Any CPU platform. Otherwise having only 64 bit assembly could work. If using third party libraries make sure you included the Any CPU version (preferred) or 64 bit version but not the 32 bit version.
You can change platform in the Configuration Manager in Visual Studio:
Reference: https://learn.microsoft.com/en-us/visualstudio/ide/how-to-configure-projects-to-target-platforms?view=vs-2019
I have downloaded what seems to be antlrworks2 from here http://tunnelvisionlabs.com/products/demo/antlrworks
But I cannot find how to run the resulting material.
The unpacked material consists of these directories
antlrworks2 bin etc ide java platform
and lots of sub directories with lot and lots of .jar files but I have no idea
what I need to run to get it operating.
You should run bin/antlrworks2 to launch the application.
Note that future releases of ANTLRWorks 2 (starting with release 2.2) will be distributed exclusively through the NetBeans Plugin Portal (and Update Center), which will simplify things significantly.
I managed to compile VTK example (http://www.vtk.org/Wiki/VTK/Examples/Cxx/PolyData/Curvatures) in MSVS 2010 but when I tried to run it, it stopped. Does anyone know the cause? I can run other VTK examples successfully but not this one.
From the comments, the problem is caused by using Release .dlls in a Debug application. Remember that the Release heap is not compatible to the Debug heap. Which means any allocations in the Release heap can not be freed in the Debug heap or vise versa. As a result of this it is not generally safe to mix Debug and Release in the same application.
Now in the case of VTK (since I have used this on many machines and have built this 100s of times using Visual Studio over the last 5+ years) my recommendations are to turn off the building of shared libraries with vtk. And avoid the use the INSTALL target with for VTK, ITK, GDCM or any CMake based library that names its release libraries the same as its debug libraries. Instead use BUILD_ALL for all configurations you will need in your application. Then when you need to configure your application to use CMake I point VTK_DIR to the root directory of the folder where I built VTK and CMake will then correctly use the Debug libraries in my Debug application, Release libraries in my Release application..
I created a JavaFX 2 self-contained application for Mac OS X. It works fine.
Inside the application bundle (.app), there's a PlugIns directory and inside the PlugIns directory there's a directory that contains the JRE.
How can I use that JRE to launch another Runnable Jar?
I look inside the JRE directory, but I can't find a java executable binary.
The reason is that the generated binary in your MacOS-Folder bootstraps java by using the libjvm.dylib directly. You could try copying the java-binary from your java installation into a folder bin next to jre
From http://docs.oracle.com/javafx/2/deployment/self-contained-packaging.htm#A1307236:
Each self-contained application package includes the following:
A private copy of the Java and JavaFX Runtimes, to be used by this application only
So it appears that by design you are not supposed to be able to use that JRE with any other application. But I am not aware of what checks are in place to enforce this.
I am new to groovy and I cannot understand, if it is possible to compile a groovy program, so it runs at all computers, were the JRE is installed.
The application I am developing has to run on any computer with JRE 1.5. Is it possible to start using groovy and maintain this flexibility? With JRE 1.6?
I have heard about the library groovy-all-VERSION.jar. Is this the one required library to be shipped with my application?
The answer is yes. In fact, all groovy code compiles down to Java classes that run on the JRE. All you need is JRE 1.4 or higher and the groovy-all-*.jar on the classpath of your application.
Since you are looking to support JRE 1.5 or higher, make sure your source compatibility is set on your compiler to this level.
There are a few options for compiling your groovy code. Groovyc (Ant Task), GMaven (Maven) and Gradle are all options.
Another option you have is to 'not' compile your groovy code. The groovy distribution only requires the JRE to be installed. You can ship your application as a set of scripts that can simply be run using the groovy install. It depends on how sensitive your source code is.
The short answer is yes. How you do this depends on your build system. I do all my development in eclipse, right click my project, select export, select runnable jar file, and all the required librarys are exported in the jar file. I can then run this file on a machine with out Groovy installed. I know build systems like Maven support Groovy but don't know the details on how they do it or how good there support is. According to this question Java 1.4 or above is fine. When looking at the "Setting up your Java environment" section of the initial tutorial it looks like you need Java 1.5 installed.