View previous topic :: View next topic |
Author |
Message |
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Sun Aug 27, 2017 11:55 pm Post subject: Java Program Puzzle - won't launch, ends with NoClassDefFoun |
|
|
First, I admit that I'm not any sort of java guru. There are a few programs that are written in java that I use, but portage has always set them up properly for me. These programs also run properly.
The Java program that I'd like to start using is kmttg.
The author has provided a simple script to start this program:
Code: |
#!/bin/sh
DIRNAME=`dirname "$0"`
java -Djava.net.preferIPv4Stack=true -jar "$DIRNAME/kmttg.jar" $@
|
However, when executed, it only issues this error message:
Code: |
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Thread-0"
|
The author and I have done a few messages back and forth, but it's not really lead to any directions towards a solution.
I run this same jar file on windows, and the entire GUI comes up correctly, so I'm wondering if there's something in my java environment that's not quite right?
On Gentoo:
Code: |
java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
|
On Windows 10:
Code: |
java -version
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)
|
Any line of investigation that is recommended that follow? |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Mon Aug 28, 2017 1:06 am Post subject: |
|
|
cd to the location where you find kmttg.jar
<scriptname> `pwd` |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Mon Aug 28, 2017 1:37 am Post subject: |
|
|
1clue wrote: | cd to the location where you find kmttg.jar
<scriptname> `pwd` |
Thanks for replying.
If I understand your post correctly, then
Code: |
sh -x ./kmttg $PWD
++ dirname ./kmttg
+ DIRNAME=.
+ java -Djava.net.preferIPv4Stack=true -jar ./kmttg.jar /usr/share/kmttg_v2.3b
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"
Shutdown hook executing
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "Thread-0"
|
Should have worked? |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Mon Aug 28, 2017 2:22 pm Post subject: |
|
|
You should not get a '.' in the DIRNAME. Put the absolute path to the jar, without the jar file name. Or circumvent the script and simply issue the command all on one line. |
|
Back to top |
|
|
1clue Advocate
Joined: 05 Feb 2006 Posts: 2569
|
Posted: Mon Aug 28, 2017 2:24 pm Post subject: |
|
|
Another thing: What's your JAVA_HOME variable say? Linux distros tend to forget that many Java apps don't work unless it's properly set. |
|
Back to top |
|
|
fedeliallalinea Administrator
Joined: 08 Mar 2003 Posts: 30894 Location: here
|
Posted: Mon Aug 28, 2017 4:21 pm Post subject: |
|
|
The problem is that program use javafx, so you shoud enable javafx use flag to dev-java/oracle-jre-bin package (or jdk) _________________ Questions are guaranteed in life; Answers aren't. |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Mon Aug 28, 2017 10:44 pm Post subject: |
|
|
1clue wrote: | You should not get a '.' in the DIRNAME. Put the absolute path to the jar, without the jar file name. Or circumvent the script and simply issue the command all on one line. |
1clue wrote: | Another thing: What's your JAVA_HOME variable say? Linux distros tend to forget that many Java apps don't work unless it's properly set. |
Code: |
env | grep -i java
JAVAC=/etc/java-config-2/current-system-vm/bin/javac
JAVA_HOME=/etc/java-config-2/current-system-vm
JDK_HOME=/etc/java-config-2/current-system-vm
MANPATH=/etc/java-config-2/current-system-vm/man:/usr/local/share/man:/usr/share/man:/usr/share/gcc-data/x86_64-pc-linux-gnu/5.4.0/man:/usr/share/binutils-data/x86_64-pc-linux-gnu/2.25.1/man:/etc/java-config-2/current-system-vm/man/:/usr/lib64/php5.6/man/:/usr/lib64/php7.0/man/
|
This might be important too.
Code: |
# eselect java-vm list
Available Java Virtual Machines:
[1] gcj-jdk
[2] icedtea-bin-7
[3] oracle-jdk-bin-1.8 system-vm
[4] oracle-jre-bin-1.8
|
fedeliallalinea wrote: | The problem is that program use javafx, so you shoud enable javafx use flag to dev-java/oracle-jre-bin package (or jdk) |
Hmm. I created a /etc/portage/package.use/java.use, which included:
>=dev-java/oracle-jdk-bin-1.8.0.144 javafx
tried to emerge emerge -1 dev-java/oracle-jdk-bin
Code: |
!!! The ebuild selected to satisfy "dev-java/oracle-jdk-bin" has unmet requirements.
- dev-java/oracle-jdk-bin-1.8.0.144::gentoo USE="fontconfig javafx -alsa -commercial -cups -derby -doc -examples -headless-awt -jce -nsplugin (-selinux) -source -visualvm" ABI_X86="(64)"
The following REQUIRED_USE flag constraints are unsatisfied:
javafx? ( alsa )
The above constraints are a subset of the following complete expression:
javafx? ( alsa fontconfig )
|
Hmm.
/etc/portage#>grep -r -i alsa *
make.conf.example:#USE="X gtk gnome -alsa"
I'm not turning alsa off, it would appear. |
|
Back to top |
|
|
Hu Moderator
Joined: 06 Mar 2007 Posts: 21607
|
Posted: Tue Aug 29, 2017 12:54 am Post subject: |
|
|
Not disabling ALSA is necessary, but insufficient. The error message says you must enable it. If it does not default to enabled, then you must enable alsa or disable javafx. |
|
Back to top |
|
|
eohrnberger Apprentice
Joined: 09 Dec 2004 Posts: 240
|
Posted: Tue Aug 29, 2017 1:41 am Post subject: |
|
|
Hu wrote: | Not disabling ALSA is necessary, but insufficient. The error message says you must enable it. If it does not default to enabled, then you must enable alsa or disable javafx. |
enabling alsa did the trick. re-emrged dev-java/oracle-jdk-bin, and bingo, kmttg is up and running.
That did the trick. Why thank you very much. Appreciate you help in this. |
|
Back to top |
|
|
|