I want to create executable bundle for windows from java's jar application using the javapackager but facing issues.
Running cmd command
javapackager -deploy -native -outdir packages -outfile Final -srcdir . -srcfiles Hello.jar -appclass sample.Main
Exception
No base JDK. Package will use system JRE.
No base JDK. Package will use system JRE.
Creating app bundle: Main in C:\Users\DELL\Desktop\Java Packager\packages\bundles
Result application bundle: C:\Users\DELL\Desktop\Java Packager\packages\bundles
java.io.IOException: Exec failed with code 2 command [[C:\Program Files (x86)\InnoSetup6\iscc.exe,
/oC:\Users\DELL\Desktop\Java Packager\packages\bundles,
C:\Users\DELL\AppData\Local\Temp\fxbundler6308867820319632690\images\win-exe.image\Main.iss] in
C:\Users\DELL\AppData\Local\Temp\fxbundler6308867820319632690\images\win-exe.image
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:165)
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:138)
at com.oracle.tools.packager.IOUtils.exec(IOUtils.java:132)
at com.oracle.tools.packager.windows.WinExeBundler.buildEXE(WinExeBundler.java:697)
at com.oracle.tools.packager.windows.WinExeBundler.bundle(WinExeBundler.java:366)
at com.oracle.tools.packager.windows.WinExeBundler.execute(WinExeBundler.java:173)
at com.sun.javafx.tools.packager.PackagerLib.generateNativeBundles(PackagerLib.java:352)
at com.sun.javafx.tools.packager.PackagerLib.generateDeploymentPackages(PackagerLib.java:319)
at com.sun.javafx.tools.packager.Main.main(Main.java:476)
Error: Bundler "EXE Installer" (exe) failed to produce a bundle.
Related
I am trying to use dask-sql in my python code which needs JAVA in the docker container.
this is my docker file
RUN apk update
RUN apk add make automake gcc g++ subversion python3-dev
RUN apk add openjdk11
ENV JAVA_HOME /usr/lib/jvm/java-11-openjdk/
RUN export JAVA_HOME
RUN export LD_LIBRARY_PATH=/usr/lib/jvm/java-11-openjdk/lib/libjava.so:/usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so
this is the code in my python file
from dask_sql import Context
c = Context()
print(c.sql('''some SQL query''')
but I am getting below error while running the code
An error occurred during the initialization of the VM
Unable to load native library: Error loading shared library libjvm.so: No such file or directory (needed by /usr/lib/jvm/java-11-openjdk/lib/libjava.so)
This is the actual path for both these files:
bash-5.1# find / -name libjava.so
/usr/lib/jvm/java-11-openjdk/lib/libjava.so
bash-5.1# find / -name libjvm.so
/usr/lib/jvm/java-11-openjdk/lib/server/libjvm.so
I'm getting the message "Missing JavaFX application class com.ponderwhy.pikeinventory.PikeInventory" after deploying with jPackage.
Using AdoptOpenJDK 16, JavaFx-16, WiX 3.11 on Windows 10. My application runs fine when I use the following JVM options file.
# -classpath aka -cp
-cp D:/WS_Utility/PikeInventory/bin;D:/WS_Utility/Basic/bin;D:/WS_Utility/ancillary/bin;C:/Java/javafx-sdk-16/lib;C:/Java/controlsfx-jfx-13/controlsfx-11.0.2.jar
# -modulepath aka -p
-p C:/Java/javafx-sdk-16/lib;D:/WS_Utility/basic/bin;D:/WS_Utility/Ancillary/bin;D:/WS_Utility/PikeInventory/bin;C:/Java/controlsfx-jfx-13/controlsfx-11.0.2.jar
--add-modules=ALL-MODULE-PATH
--add-exports javafx.base/com.sun.javafx.collections=ALL-UNNAMED
--add-exports javafx.base/com.sun.javafx.runtime=ALL-UNNAMED
--add-exports javafx.controls/com.sun.javafx.scene.control=ALL-UNNAMED
--add-opens javafx.graphics/com.sun.javafx.css=ALL-UNNAMED
com.ponderwhy.pikeinventory.PikeInventory
When I use jPackage to build an.exe file using the following jPackage commands:
--type exe
--app-version 1.0.1
--description "Pike Inventory"
--name PikeInventory
--vendor PonderWhy
--verbose
--java-options -splash:$APPDIR//RockF7.jpg
--input D:/Dev/TrainInv/jPackage
--icon D:/Dev/TrainInv/jPackage/LocoFront.ico
--main-jar PikeInventory.jar
--main-class com.ponderwhy.pikeinventory.PikeInventory
--module-path C:/Java/javafx-jmods-16;C:/Java/controlsfx-jfx-13;C:/Java/JDK-16/jmods;D:/Dev/TrainInv/jPackage
--add-modules javafx.base,javafx.controls,javafx.fxml,javafx.graphics,javafx.media,javafx.swing,javafx.web
--win-console
--win-dir-chooser
--win-menu
--win-menu-group PikeInventory
--win-shortcut
# --win-upgrade-uuid PkInv
I have the 2 environment variables set that I find some references to.
PATH_TO_FX=C:\Java\javafx-sdk-16\lib
PATH_TO_FX_MODS=C:\Java\javafx-jmods-16
All three of my projects, Basic, Ancillary and PikeInventory have module-info.class.
The jPackage builds, deploys and installs without error. My splash comes up then the missing class message.
I am at a loss at what to try next to resolve my problem.
Any help would be greatly appreciated.
Peter
I am creating a sample application with 3 modules user, dept and account. In my user module, I have a main class and compile my modules with the following command:
javac -d target --module-source-path src $(find -name "*.java")
After compiling, execute following command for run:
java -p target -m com.user/com.user.info.Launcher
The output after running java modules are successful. But when trying to create runtime image using jlink the image created successfully but module executable script is not there. For create an image, I am using the following command:
jlink --module-path $JAVA_HOME/jmods:target --add-modules com.user --output my-app
In, runtime image, I have bin directory, but this directory contains only java and keynote script. I am expecting user main class script as well, for executing my application.
My Java version as below:
java version "9-ea"
Java(TM) SE Runtime Environment (build 9-ea+165)
Java HotSpot(TM) 64-Bit Server VM (build 9-ea+165, mixed mode)
How can I resolve this problem?
jlink creates a runtime VM image in which it includes only the modules that are needed.
Since you specified --add-modules com.user the image will include the com.user module, and all of the modules it (directly or indirectly) depends on.
You can run your application by using the java binary in the bin folder of the generated image, and using the command:
java com.user.info.Launcher
You can also have jlink generate a launcher script using the --launcher <command>=<module>/<main> option. In your case you could do something like:
jlink --module-path $JAVA_HOME/jmods:target --add-modules com.user --output my-app --launcher launch=com.user/com.user.info.Launcher
And after that, you can just use launch from the bin directory to run the application.
Deploy weblogic using jenkins without jenkins plugin.
jenkins weblogic plugin use this command. So I try use it.
/bin/java -Xms256M -Xmx256M -cp /root/wls12210/wlserver/server/lib/weblogic.jar weblogic.Deployer -debug -stage -remote -verbose -upload -name testPage -source /root/.jenkins/workspace/WebLogic/target/testPage.war -targets AdminServer -adminurl t3://127.0.0.1:7001 -user {ID} -password {password} -deploy
But If I use this command not use plugin but only raw command, there is error.
error: Cannot find basic class weblogic.Deployer or cannot load weblogic.Deployer.
above error evoke as korean language, so I translated to english.
under error is jenkins error part.
[WeblogicDeploymentPlugin] - ARTIFACT UNDEPLOYED SUCCESSFULLY.
[WeblogicDeploymentPlugin] - DEPLOYING ARTIFACT... $
/bin/java -Xms256M -Xmx256M -cp
/root/wls12210/wlserver/server/lib/weblogic.jar weblogic.Deployer
-debug -stage -remote -verbose -upload -name testPage -source /root/.jenkins/workspace/WebLogic/target/testPage.war -targets
AdminServer -adminurl t3://127.0.0.1:7001 -user {id} -password
{passwd} -deploy [WeblogicDeploymentPlugin] - ARTIFACT DEPLOYED
SUCCESSFULLY. [INFO]
[INFO] DEPLOYMENT SUCCESS [INFO]
SSH: Connecting from host [localhost.localdomain]
SSH: Connecting with configuration [weblogic] ...
SSH: EXEC: STDOUT/STDERR from command[
/bin/java -Xms256M -Xmx256M -cp /root/wls12210/wlserver/server/lib/weblogic.jar weblogic.Deployer
-debug -stage -remote -verbose -upload -name testPage -source /root/.jenkins/workspace/WebLogic/target/testPage.war -targets
AdminServer -adminurl t3://127.0.0.1:7001 -user {id} -password
{passwd} -deploy
error: Cannot find basic class weblogic.Deployer or cannot load weblogic.Deployer.
How can I solve this error?
Have you tried building wlfullclient.jar and putting that on your classpath instead? weblogic.jar doesn't have any of the ancillary libraries that you'll probably need.
Better load the weblogic environment first, it will load all the weblogic related classes you may need:
According to the path you showed, run this in command line before you try to start the java virtual machine:
". /root/wls12210/wlserver/server/bin/setWLSEnv.sh"
I have been trying to get GitLab CI to build my LWJGL project with no luck, after about an hour of tinkering I have this as my .gitlab-ci.yml:
image: java:8-jdk
buildtest:
script:
- mkdir bin
- javac -cp dependencies/lwjgl/lwjgl.jar -d bin/ src/*.java
- cd bin
- java HelloWorld
However after finally getting it to compile correctly, when it comes time to run the code it gets the following log:
$ mkdir bin
$ javac -cp dependencies/lwjgl/lwjgl.jar -d bin/ src/*.java
$ cd bin
$ java HelloWorld
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" java.lang.NoClassDefFoundError: org/lwjgl/glfw/GLFWKeyCallback
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
at java.lang.Class.getMethod0(Class.java:3018)
at java.lang.Class.getMethod(Class.java:1784)
at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
Caused by: java.lang.ClassNotFoundException: org.lwjgl.glfw.GLFWKeyCallback
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 7 more
ERROR: Build failed: exit code 1
It seems to me that it cannot find org.lwjgl.glfw.GLFWKeyCallback, however when compiled locally it works fine. So I cannot figure out what the issue is, any ideas?
EDIT:
After messing around with this some more, I ended up trying this on my machine and the following works in command prompt, but not in a shell script and because GitLab CI uses linux it does not work there either.
Here is the shell script I wrote real quick to test along with the new error:
mkdir bin
javac -cp dependencies/lwjgl/lwjgl.jar -d bin/ src/*.java
cd bin
java -cp ../dependencies/lwjgl/lwjgl.jar; -Dorg.lwjgl.librarypath=../dependencies/lwjgl/native/ HelloWorld
Error (I know its the usage for java.exe, but it prints both that and the error at the end):
Usage: java [-options] class [args...]
(to execute a class)
or java [-options] -jar jarfile [args...]
(to execute a jar file)
where options include:
-d32 use a 32-bit data model if available
-d64 use a 64-bit data model if available
-server to select the "server" VM
The default VM is server.
-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
A ; separated list of directories, JAR archives,
and ZIP archives to search for class files.
-D<name>=<value>
set a system property
-verbose:[class|gc|jni]
enable verbose output
-version print product version and exit
-version:<value>
Warning: this feature is deprecated and will be removed
in a future release.
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
Warning: this feature is deprecated and will be removed
in a future release.
include/exclude user private JREs in the version search
-? -help print this help message
-X print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions with specified granularity
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
bash: -Dorg.lwjgl.librarypath=../dependencies/lwjgl/native/: No such file or directory
I know for a fact that this directory exists though because I can get it to work in the following way with command prompt:
javac -cp dependencies/lwjgl/lwjgl.jar -d bin/ src/*.java
cd bin
java -cp ../dependencies/lwjgl/lwjgl.jar; -Dorg.lwjgl.librarypath=../dependencies/lwjgl/native/ HelloWorld
Output from command prompt version:
E:\test\bin>java -cp ../dependencies/lwjgl/lwjgl.jar; -Dorg.lwjgl.librarypath=../dependencies/lwjgl/native/ HelloWorld
Hello LWJGL 3.0.0b SNAPSHOT!
E:\test\bin>
You have to set the library path to the folder containing the native files.
java -Dorg.lwjgl.librarypath=path/to/natives HelloWorld
You can find the files (which have endings .so, .dylib and .dll) in the native folder of the LWJGL zip file.