Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Java Program Puzzle - won't launch, ends with NoClassDefFoun
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
eohrnberger
Apprentice
Apprentice


Joined: 09 Dec 2004
Posts: 240

PostPosted: Sun Aug 27, 2017 11:55 pm    Post subject: Java Program Puzzle - won't launch, ends with NoClassDefFoun Reply with quote

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
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Mon Aug 28, 2017 1:06 am    Post subject: Reply with quote

cd to the location where you find kmttg.jar
<scriptname> `pwd`
Back to top
View user's profile Send private message
eohrnberger
Apprentice
Apprentice


Joined: 09 Dec 2004
Posts: 240

PostPosted: Mon Aug 28, 2017 1:37 am    Post subject: Reply with quote

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
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Mon Aug 28, 2017 2:22 pm    Post subject: Reply with quote

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
View user's profile Send private message
1clue
Advocate
Advocate


Joined: 05 Feb 2006
Posts: 2569

PostPosted: Mon Aug 28, 2017 2:24 pm    Post subject: Reply with quote

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
View user's profile Send private message
fedeliallalinea
Administrator
Administrator


Joined: 08 Mar 2003
Posts: 30894
Location: here

PostPosted: Mon Aug 28, 2017 4:21 pm    Post subject: Reply with quote

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
View user's profile Send private message
eohrnberger
Apprentice
Apprentice


Joined: 09 Dec 2004
Posts: 240

PostPosted: Mon Aug 28, 2017 10:44 pm    Post subject: Reply with quote

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
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Tue Aug 29, 2017 12:54 am    Post subject: Reply with quote

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
View user's profile Send private message
eohrnberger
Apprentice
Apprentice


Joined: 09 Dec 2004
Posts: 240

PostPosted: Tue Aug 29, 2017 1:41 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum