Grant wrote:
I'm trying to fix up the JAlbum ebuild:
http://bugs.gentoo.org/show_bug.cgi?id=128356
and get it to use java-pkg-2. Here's what I have so far:
inherit java-pkg-2 eutils
S="${WORKDIR}/Jalbum"
DESCRIPTION="Web photo album generator"
HOMEPAGE="http://jalbum.net/"
SRC_URI="http://jalbum.net/download/Jalbum${PV}.zip"
LICENSE="as-is"
SLOT="0"
KEYWORDS="x86"
IUSE=""
DEPEND=">=virtual/jre-1.5"
RDEPEND="${DEPEND}"
src_install() {
java-pkg_dojar JAlbum.jar
java-pkg_dolauncher jalbum \
--jar JAlbum.jar \
--java_args -Xmx400M
local dest=/usr/lib/${PN}
dodir ${dest}
cp -R ${S}/* ${D}/${dest} || die "Install failed"
doicon ${FILESDIR}/Jalbum-icon.png
make_desktop_entry ${PN}
}
It executes just fine, but I get:
$ jalbum
Error: se.datadosen.jalbum.JAlbum
java.lang.ClassNotFoundException: se.datadosen.jalbum.JAlbum
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at se.datadosen.jalbum.Main.main(Main.java:23)
I was told I need to define the main class with --main. Does anyone
know how to determine what the main class should be?
No, it has clearly already loaded at least one class (last line of that
stack trace reveals this), and is looking for some others needed by that
class -- but the classloader fails to find them. JAlbum probably also
has a Main-Class header defined in the jar's manifest, so this is likely
to be just another classpath-related issue.
But the ebuild you're pushing ... I think it would need some serious
work for the installation part. I think it installs files in all wrong
places, and thus Gentoo's Generation 2 java system cannot automatically
add them to classpath.
There is some advice on the issue in section 3, the Filesystem layout
over here:
http://www.gentoo.org/proj/en/java/java-devel.xml
After trudging through that you might understand why Gentoo Java team
has constantly several dev positions advertised on "help wanted". Some
of Java's ways don't mix that well with Gentoo's approaches, especially
with compiling and packaging (installations).
If you are in a hurry of some sort, you might just try taking the jar,
unpacking it into a subdir under your homedir, cd'ing in, and trying
something like "CLASSPATH=.:${CLASSPATH} foo.sh". With a little luck it
might work as such, without the pain of making a proper ebuild for it.
--
Arttu V.