• Packaging a .jar file for Arch


    Guys, this will be a true newbie question, sorry. I’ve been reading wiki for hours, and still have no idea where to start from.

    Background: I’m not a pro, but just an after-hours coder, and so far I have some experience with Android / Android Wear apps only. However, after almost 3 years of coding for the Play Store, I find it a little bit boring and disappointing, so decided to learn something new. I took the code of a game I had written for Android (this was a clone of what I had written in 1992 for 8-bit computers), and re-wrote it in JavaFX.

    Problem: I have no idea on how to distribute the working .jar file on Linux at all, and on Arch specifically. If it comes to Windows executable, I just used launch4j, and it builds the .exe to my taste in seconds. If I remember well, on Debian-based distribution it’s possible to download a .deb package (still I don’t know how to build it), and just click to install.

    Question: Could anyone tell me which steps I should take to distribute the game on Arch-based distro? The .jar file has all resources bundled inside, and needs just the java-runtime (probably only Oracle jre will do, but it seems to be included), and ffmpeg2.8.

    I’ll appreciate any help.

  • @piotr said in Packaging a .jar file for Arch:

    I have no idea on how to distribute the working .jar file on Linux at all, and on Arch specifically.

    I know you would have to create a PKGBUILD file and formatting it as .tar I think to get it on the AUR. However, I am completely lost on how to do any of those things except for making the package in the .tar format. Perhaps someone else could help? (I would also like to learn how to do this, as I have my own packge I would like to upload to the AUR here, but have no idea where to start. I think perhaps @psscnp142 might know, but I could be wrong there…)

  • A month ago I knew nothing about JavaFX, so I believe any question may be answered by just searching the web, but…

    @Keegan said in Packaging a .jar file for Arch:

    I think perhaps @psscnp142 might know

    …it would be great if someone could help us take the first step. :)

  • Add an executable sh file (chmod +x) with “java -jar whatever.jar” to launch it.

  • @Wyn said in Packaging a .jar file for Arch:

    Add an executable sh file (chmod +x) with “java -jar whatever.jar” to launch it.

    Yep, but this:

    • still demands manual files copying,
    • will not work if jre or ffmpeg2.8 is missing.
  • @joekamprad said in Packaging a .jar file for Arch:

    PKGBUILD HOWTO

    Also: Creating packages and Java package guidelines were necessary, but you’re absolutely right: no other way to deal with it. :)

    If anyone (please!) could take a look and say if it installs well:

    • download here;
    • install: sudo pacman -U eist-returns-0.0.1-1-x86_64.pkg.tar

    There’s still something wrong about the desktop entry: displays the package name instead of Name=Eist returns, and I don’t yet know how to add it to the Games category. But it’s 5:40 am…

    BTW: on my dual graphics it only works fluently if I add ‘optirun’ to the activator, like optirun java -jar /usr/share/java/eist-returns/eist-returns.jar.

  • if you you provide also the PKGBUILD i will.
    But without knowing what the package will do, i would not install it with root rights.

  • @joekamprad said in Packaging a .jar file for Arch:

    if you you provide also the PKGBUILD i will.

    You’re right again. Missing files uploaded to the same place. By the way - could you tell me what’s wrong about the .desktop file? I expected it to display “Eist returns” as the name.

    If it comes to the game itself, I only tested it on my main (Antergos) and secondary (Windows 10) development machines, so please find it the 1st beta. It may turn out that I overlooked some dependencies.

    In case you want to play a board or two, the game should be self-explanatory. If I’m wrong, you may find more info here, but it’s slightly out of date, as it was written for the Android version. The desktop version does not use extra lives (and lives at all), and does not support the game pad. Also the menu has been redesigned.

  • You can try using Arronax it is a program to create .desktop files

  • eist-returns.jar
    Exception in thread "main" java.lang.NoClassDefFoundError: javafx/application/Application
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	at java.lang.ClassLoader.defineClass1(Native Method)
    	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
    	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
    	at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
    	at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
    	at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
    	at java.security.AccessController.doPrivileged(Native Method)
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	at game.Start.main(Start.java:15)
    Caused by: java.lang.ClassNotFoundException: javafx.application.Application
    	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    	... 25 more
    

    This is the output after calling the command, but I have no pale glimmer of Java

  • @joekamprad said in Packaging a .jar file for Arch:

    This is the output after calling the command, but I have no pale glimmer of Java

    Wow, you’ve just made me dust off a really ancient hardware, and open a bottle of porter! :)

    alt text

    It seems I need a testing environment with no jdk installed. Otherwise the java.lang.NoClassDefFoundError never happens. I do need to reproduce it to fix it. That’s why I took my daughters old desktop, not in use for over 3 years.

    Possibly I’ll also need to try and understand this:

    for name in /usr/share/java/myprogram/*.jar ; do CP=$CP:$name done CP=$CP:/usr/share/java/dep1/dep1.jar java -cp $CP myprogram.java.MainClass

    as written in Java package guidelines. I must admit I couldn’t get it so far.

    Thanks for help. Would you mind doing this again when the new package is ready?

  • @piotr said in Packaging a .jar file for Arch:

    Would you mind doing this again when the new package is ready?

    I am here anyway ;)

  • @joekamprad said in Packaging a .jar file for Arch:

    I am here anyway

    Well, it seems the ‘java-openjfx’ dependency was necessary. Could you take another look at the download site? The current package file is ‘eist-returns-0.0.1-3-x86_64.pkg.tar’, and also PKGBUID has been updated.

    Damn, on the vintage machine I’ve just resurrected (Intel Pentium 3 GHz x2, 2 GB RAM, 1GB Nvidia, proprietary drivers) the graphics is much, much more fluent that on my contemporary laptop. :/

  • @piotr
    You probably could use VirtualBox for testing purposes, no need for ancient machines.
    Edit: sorry I didn’t read properly your post, my bad.

  • @manuel said in Packaging a .jar file for Arch:

    You probably could use VirtualBox

    That’s a problem, indeed. At the office some time ago I’ve been given a really powerful machine, the best I’ve ever had. Still on the VM the graphics performance sucks. :)

  • @piotr
    Yeah, that’s the problem with VMs, unfortunately.

  • @piotr said in Packaging a .jar file for Arch:

    java-openjfx

    needs qt5 :(

  • @joekamprad said in Packaging a .jar file for Arch:

    needs qt5

    Damn, at current dependencies it worked for me on a fresh Antergos install! Do you think I should add ‘qt5-base’ dependency?

Posts 26Views 2771
Bloom Email Optin Plugin

Looks like your connection to Antergos Community Forum was lost, please wait while we try to reconnect.