Installation in Ubuntu 18.04

Here's the place to discuss anything about Negatron or MAME in English.
Post Reply
alexb3d
Posts: 4
Joined: Sun Feb 10, 2019 7:57 am

Installation in Ubuntu 18.04

Post by alexb3d »

Hi. I recently met Negatron, I am trying to install on Ubuntu 18.04 without success.
I downloaded the .deb, it installs and nothing happens.
I downloaded "Cross platform pack" and when I run it from the console it gives me the following error:

Code: Select all

Error: Could not find or load main class net.babelsoft.negatron.NegatronApp
Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
I have Java installed from PPA

Code: Select all

java 11.0.2 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+7-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+7-LTS, mixed mode)
I have VLC 3.0.6 installed from Flatpak.
BabelSoft
Site Admin
Posts: 342
Joined: Sat Jun 02, 2012 9:23 pm

Re: Installation in Ubuntu 18.04

Post by BabelSoft »

The .deb should have installed Java 8 and JavaFX 8 for you.
I didn't think about how to force Negatron to use this version when you have several versions of Java on your machine. But you can edit Negatron.sh to launch Java 8 instead of the default Java 11.

I didn't test Negatron with Java 11 but, if it works with this version, you'll also need JavaFX 11 anyway, available there. Oracle made big changes with Java 9+ so I don't think Negatron can work with Java 11 without issues but that's also why I didn't migrate Negatron to more recent versions of Java yet: I need time to properly change all the titbits.
alexb3d
Posts: 4
Joined: Sun Feb 10, 2019 7:57 am

Re: Installation in Ubuntu 18.04

Post by alexb3d »

The first installation was of .deb, without Java 11.
It is installed normal, but it does not appear in the menu, I do not know how to start it.

Then I installed Java 11 because in the requirements it says "Java v8.60 or later"
It's a PPA, I can delete it and install 8, but if the .deb installs Java, it should work.
BabelSoft
Site Admin
Posts: 342
Joined: Sat Jun 02, 2012 9:23 pm

Re: Installation in Ubuntu 18.04

Post by BabelSoft »

lol I didn't know that .deb could install something in menus. As there are 1000 of Linux distros, I don't even know if there is a common place to all distros to install menu entries... I'll try to search this on my own but, if you can help me with some pointers, I'd be grateful.

The .deb install Negatron in /opt/negatron and there's a Negatron.sh to launch Negatron in the folder. But if you have several Java versions installed on this machine, you may have to edit this .sh file for Negatron to explicitly use Java 8.
alexb3d
Posts: 4
Joined: Sun Feb 10, 2019 7:57 am

Re: Installation in Ubuntu 18.04

Post by alexb3d »

I do not understand what the joke is. All the programs that I install appear in the menu.

I just made a new installation. I do not have Java. I take the opportunity to install Negatron from scratch.

When I click on the file /opt/negatron/Negatron.sh I get a text document with this information:

Code: Select all

#!/bin/sh

java_err()
{
    echo "Negatron requires Oracle's Java or OpenJDK/OpenJFX 8u60+ to run"
    exit 1
}

JAVA=`which java`
[ -z "$JAVA" ] && java_err

JRE=`java -version 2>&1 | head -1 | awk '{print $1}'`
[ "$JRE" = "java" ] || [ "$JRE" = "openjdk" ] || java_err

$JAVA -Xms512m -Xmx2g -jar Negatron.jar
BabelSoft
Site Admin
Posts: 342
Joined: Sat Jun 02, 2012 9:23 pm

Re: Installation in Ubuntu 18.04

Post by BabelSoft »

The difficulty about menus isn't a joke. Linux has several different desktop environments like Gnome, KDE, Xfce, etc. And I don't know how to detect which environment is installed on a particular machine or if all those environments can fetch those menus from a common solution. At work, I mainly work on Unix or Windows, so I'm not that knowledgeable with Linux :p

As for the .sh file being opened as a text file, this means that I forgot to add the executable rights to this file at installation... I'll fix it for the next version, sorry about this. In the mean time, you can add this right yourself and click on the icon again. If it still don't work, please report this to me. I'll try my best to help you to get something eventually working :p

With Unix, I'm used to do everything with command lines, so feedbacks like yours are quite useful to actually make something graphical working on Linux. Again, sorry about this.
alexb3d
Posts: 4
Joined: Sun Feb 10, 2019 7:57 am

Re: Installation in Ubuntu 18.04

Post by alexb3d »

...I'm fond of the terminal, but I like to have a well-armed desk (I'm a designer)

Linux saves the launchers in the same direction, independent of the distro or the desktop. That's what I understand, I'm going to find out more about the subject.
To all users:

Code: Select all

/usr/share/applications
In local for a single user:

Code: Select all

~/.local/share/applications
These are * .desktop files that can be opened with any text editor.

For example, Jdownloader2 is installed in local:

Code: Select all

#!/usr/bin/env xdg-open
[Desktop Entry]
Type=Application
Name=JDownloader 2
Exec=/bin/sh "/home/lex/.jd2/JDownloader2"
Icon=/home/lex/.jd2/.install4j/JDownloader2.png
Categories=Network;Application;
I made the file Negatron.sh executable with the chmod command. And I execute it with the command ./Negatron.sh.
The first time it was executed, it showed me the selection screen and it was closed.
I run it again and it shows me this message:

Code: Select all

lex@home:/opt/negatron$ ./Negatron.sh
Gtk-Message: 00:29:47.444: Failed to load module "canberra-gtk-module"
Exception in Preloader start method
java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:389)
	at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.RuntimeException: Exception in Preloader start method
	at com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:899)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication$1(LauncherImpl.java:182)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NumberFormatException: For input string: "161-ea"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at net.babelsoft.negatron.preloader.NegatronPreloader.start(Unknown Source)
	at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$6(LauncherImpl.java:785)
	at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
	at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
	at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
	at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at com.sun.glass.ui.gtk.GtkApplication.lambda$null$5(GtkApplication.java:139)
	... 1 more
Exception running application net.babelsoft.negatron.NegatronApp
BabelSoft
Site Admin
Posts: 342
Joined: Sat Jun 02, 2012 9:23 pm

Re: Installation in Ubuntu 18.04

Post by BabelSoft »

Thanks for explaining how these menu entries work. That will help me plenty :)

As for your error, the hint is given by this line:

Code: Select all

Caused by: java.lang.NumberFormatException: For input string: "161-ea"
This tells me that you have Java 6.1 early access installed on your machine and this is your default Java version. Early access means beta version. Somebody else already reported this to me and I thought those beta versions were rarely installed on Linux. That's why I didn't made any special fixes to better handle those beta versions. I should probably do something more explicit to let users identify this kind of issues.

Anyway, Java 6.1 is too old a version. You can do 3 things to mitigate this issue:
- you can edit Negatron.sh to force Negatron to use a more recent version of Java,
- you can change the default Java version used by application to a more recent version suitable for Negatron i.e. Java 8,
- you can uninstalled Java 6.1 early access (1.61-ea) if you don't have any other applications requiring such an old Java version.
I'll try to find a way for Negatron to automatically select the good Java version on machines having several installed Java versions.
Post Reply