Using JPackage on modular application without JLink? - maven

I'm trying to create an installer for my application using JPackage. My understanding is that JPackage takes two inputs: your Java application and a Java runtime. Now, if your application is modular, you typically generate a custom Java runtime using jlink. However, I'm having trouble getting jlink to work because one of my dependencies is an automatic module and I'd have to generate an explicit module declaration first.
As a shortcut, is there a way to run JPackage without jlink for a modular application? My goal here is to create an installer/executable, even if it's not the smallest in size. Can I pass the full JRE as an input?
What are my options here? Thank you!

Related

Is it possible to pick up any library from the Maven repository and use into Quarkus app

I am new to the Quarkus, Is it possible to pick up any library from the Maven repository and use into Quarkus app.
or i can only use these Code.
Is there any impact on performance?
If you plan on building a Java app deployed on the JVM, you should be able to use any library.
Things are a bit different if you plan to build a native executable. In this case, a library might need some additional metadata for GraalVM. That's one of the things we do in our Quarkus extensions.

Using Openjfx 11 classes in an OSGi application

Does anyone know if there is a way to use JavaFX modules in eclipse workspace? I have an OSGi-maven multi-modular application.
Up until now, I have tried a couple of things.
To download JavaFX SDK and to add jars in eclipse as a user-defined library.
To bundle JavaFX jars and to use them as regular OSGi bundles after that (added as dependency and after that in target-platform).
Both of these things work. But, in the first case, every developer would have to manually add those jars as a library on the classpath. And in the second for every platform, we would have to have a different bundle for each module.
If I do neither of those things I have compile errors that JavaFX classes cannot be found (as expected).
Is there some third way to do this? By using some OSGi functionality or something like that?
I haven't found any way to add a module in MANIFEST.MF. Is that even possible?
I have added JavaFX modules as VM arguments in the OSGi framework launcher, and everything works fine. But I have to do one of those things mentioned before so that I don't have compile errors.
VM arguments: --module-path /path/to/javafx/sdk/11/lib --add-modules javafx.controls,javafx.graphics,javafx.base
I tried to convert an E4/OSGI/GEF/JavaFx project that uses JRE 8 to JRE 11 and OpenJFX 11, and found a way to do so.
In my case, I use SWT and javafx.embed.swt.FxCanvas. Including the user defined JavaFX library in the modulepath didn't work, generating class not found errors during compile-time; but including the library in classpath worked.
I also couldn't run the application using --module-path arguments; it gave NoClassDefFoundError exception for org.eclipse.swt.widgets.Canvas
My solution uses E(fx)clipse, which could also be the third option for you. After including the javafx libraries in the classpath, and including org.eclipse.fx.osgi in the project configuration, I used the following VM parameters to load JavaFX classes using E(fx)clipse.
-Dosgi.framework.extensions=org.eclipse.fx.osgi -Defxclipse.java-modules.dir=[openjfx-lib-directory]
You can also add -Defxclipse.osgi.hook.debug=true" to see debug messages from E(fx)clipse while loading the classes.

Build JavaFX application with preloader

I use IntelliJ IDEA IDE and I want use the Gradle system as a build system in my JavaFX application. I want to create preloader for my program and pack it with program into one jar file. Here says that I must have at least two modules: application and preloader. How build the JavaFX application with preloader by using gradle system?
Disclaimer: I'm the creator and maintainer of the javafx-gradle-plugin.
You don't need to create some preloader, it is used while the JVM loads the libraries and while booting all classloaders, but you don't have to create some preloader.
There is a conflict in interests here: you are using two systems to generate that javafx-appliaction, one is the gradle-build-system, the other is your IntelliJ IDEA-IDE. There is a JavaFX-plugin for IDEA, which does some things, and there is the gradle-plugin i wrote, which does some things withing normal gradle-development-cycle.
The javafx-gradle-plugin is IDE-agnostic, so you are not required to have some IDEA-plugins enabled.
To have some example with included usage of proguard, you can see it at github.

How to create custom library with gradle `compile` support in AndroidStudio?

I'd like to create my own gradle library, that can be compiled into other projects using gradle compile statement.
Example from Picasso's README:
Download the latest JAR or grab via Gradle:
compile 'com.squareup.picasso:picasso:2.5.2'
I'm developing few applications that share common source: fragments, views, some logic... Sometimes I extend these sources while I'm developing app A, sometimes while I'm developing app B,... And I feel that copy-paste of packages/classes in Android Library Module is not an proper solution.
So I would like to setup my own library, that:
it could be easily deployed to as gradle library that could be used by compile.
I can easily develop/extend it together with currently developed application
Disclaimer: I had been googling it a lot, but without luck.
If you want to reuse a library across completely separate projects then you'll want to publish your library to repository. Assuming this is open source and you don't mind sharing, you could use JCenter, which is already added as a repository to Android projects by default.
https://www.virag.si/2015/01/publishing-gradle-android-library-to-jcenter/

Need help to get started with Spring framework

I want to learn Java EE Spring framwork. So, I downloaded Spring Tool Suite from their site, and I followed this "Hello World" example: http://www.tutorialspoint.com/spring/spring_hello_world_example.htm
As you can see, he is importing some .jar files, and I also import them but I dont have antlr-runtime-3.0.1 and commons-logging-1.1.1, or at least I cant find them.
So when I run try to run application, I dont know how to run application, because I have just 2 options: AspectJ/Java and Java application.
Of course, when I try to run app, I get error.
You can take look at screenshoot.
Here is a good place to go look for jars:
http://mvnrepository.com/artifact/org.antlr/antlr-runtime
Notice this page has several versions of antlr. If you click the link to 3.0.1, you can download the jar.
There is probably a website for antlr that has the jars but it might not have old ones where they are easy to find.
Similarly for commons-logging, there is an Apache site for it. But you can find it by searching at http://mvnrepository.com though you may have to poke around to find it.
For your second question, run as a Java application. The tutorial has a class MainApp that contains a main() method. You use MainApp as the starting class and it will begin running the main() method's code.
This is standard Java behavior. You might want to run through some simple Java tutorials to learn how plain old Java works and then add Spring Framework when you are a bit more proficient.
In your case the Java Application runner is appropriated cause you're indeed writing a java application.
The tutorial you're following specify to install first spring and commons-logging API.
(http://www.tutorialspoint.com/spring/spring_environment_setup.htm) You will then be able to find the expected libraries in the APIs installation folders.
I would recommand to use maven for every java project, it will allow you to easly manage your dependencies.

Resources