Похожие чаты

Hello, Java community. I wanted to export my javafx project (openjdk14,

maven) into a jar file using jlink. It requires my project to be modular. In order to make it modular (I use default module, I don't need more modules), I need to create module-info.java
I feel desperate. I tried to create it many times but always get some errors, like "this module does not exist" and other stupid stuff.
I suck at modularity in java.
Any idea how to create module-info.java?

1 ответов

3 просмотра

I don't have experience using jlink directly, but I used a maven plugin for that and it was pretty straightforward to setup: 1. Create module-info.java and compile all your classes to a jar with maven-jar-plugin. 2. Download library jars if there are any (they should be modularized already) with maven-dependency-plugin. 3. Specify what modules you want to be built in the plugin config and where all the jars are located. 4. You get a custom runtime with your program already embedded into it. module-info.java Suppose your sources located under app/src/main/java/com/example/application and your main class is com.example.application.Main. Your module-info.java should be put at app/src/main/java/module-info.java and look like this: module com.example.application { opens com.example.application; exports com.example.application; } If you want to introduce any library dependency, just add requires com.library; there. Honestly, I don't remember the difference between opens and exports, maybe exports is enough. I used opens & exports for a package with my main class, and only exports for all other packages. jlink plugin: https://github.com/moditect/moditect The description says Java 9, but it works fine with later versions. Example configuration: https://pastebin.com/9yFmKi1L

Похожие вопросы

Обсуждают сегодня

я не магистр хаскеля, но разве не может лейзи тип конвертнуться в не-лейзи запросив вычисление содержимого прям при инициализации?
deadgnom32 λ madao
100
Ребят такой вопрос я хочу пранк сделать в колледже и убрать все права установить 000 рекурсивно у домашней директории юзера, установить переменную окружения PATH в "" и сделат...
Super Sigma
21
Всем привет! Массив вводится с клавиатуры, кол-во элементов неизвестно, поэтому я указал arr db 100 dup(?) С нахождением максимума проблем нет, а вот минимум почему-то всегд...
En Vind Av Sorg
11
в сях есть множество как в питоне? для удаление дубликатов
Linus
25
Hi everyone, long time no see! 🐼 recently i want to update our Ergo Eco-System map, can everyone help to find out, which to delete and other new to add in? list it, that i can...
HEROKOO
13
I will wait, no problem, I invested in other project also, but with my 8 years experience I can see when something is not good enough. Last bull market everyone was so excited...
jeronim jurakovic
1
hi, just reinstalled komodo wallet, and can't find ARRR on there? tried to search ARRR and pirate and nothing came up... is arrr still supported on komodo wallet. it's been ...
Pilner
6
читать файл максимально быстро? странный вопрос))
zamtmn
53
If arrr gets implemented on cake wallet. Would that mean arrr/xmr swaps possible in cake wallet like atomic swaps on komodowallet ?
Keks Meister 🏴‍☠️
22
This topic is discussed al lot. Please use the search function for the answers. The same question pops up every two weeks. First check this video https://www.youtube.com/watch...
Enrico
2
Карта сайта