Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] ebuild help: java main class?
Date: Sat, 24 Oct 2009 21:13:50
Message-Id: 200910242312.43760.alan.mckinnon@gmail.com
In Reply to: Re: [gentoo-user] ebuild help: java main class? by Grant
1 On Saturday 24 October 2009 22:32:18 Grant wrote:
2 > >> I'm trying to fix up the JAlbum ebuild:
3 > >>
4 > >> http://bugs.gentoo.org/show_bug.cgi?id=128356
5 > >>
6 > >> and get it to use java-pkg-2. Here's what I have so far:
7 > >>
8 > >> inherit java-pkg-2 eutils
9 > >>
10 > >> S="${WORKDIR}/Jalbum"
11 > >> DESCRIPTION="Web photo album generator"
12 > >> HOMEPAGE="http://jalbum.net/"
13 > >> SRC_URI="http://jalbum.net/download/Jalbum${PV}.zip"
14 > >>
15 > >> LICENSE="as-is"
16 > >> SLOT="0"
17 > >> KEYWORDS="x86"
18 > >> IUSE=""
19 > >>
20 > >> DEPEND=">=virtual/jre-1.5"
21 > >> RDEPEND="${DEPEND}"
22 > >>
23 > >> src_install() {
24 > >> java-pkg_dojar JAlbum.jar
25 > >> java-pkg_dolauncher jalbum \
26 > >> --jar JAlbum.jar \
27 > >> --java_args -Xmx400M
28 > >>
29 > >> local dest=/usr/lib/${PN}
30 > >> dodir ${dest}
31 > >> cp -R ${S}/* ${D}/${dest} || die "Install failed"
32 > >>
33 > >> doicon ${FILESDIR}/Jalbum-icon.png
34 > >> make_desktop_entry ${PN}
35 > >> }
36 > >>
37 > >> It executes just fine, but I get:
38 > >>
39 > >> $ jalbum
40 > >> Error: se.datadosen.jalbum.JAlbum
41 > >> java.lang.ClassNotFoundException: se.datadosen.jalbum.JAlbum
42 > >> at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
43 > >> at java.security.AccessController.doPrivileged(Native Method)
44 > >> at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
45 > >> at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
46 > >> at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
47 > >> at se.datadosen.jalbum.Main.main(Main.java:23)
48 > >>
49 > >> I was told I need to define the main class with --main. Does anyone
50 > >> know how to determine what the main class should be?
51 > >
52 > > What's the line normally used to launch the app at runtime? That,
53 > > together with CLASSPATH will tell you what class should be executed as
54 > > main()
55 >
56 > There is a file called startjalbum.sh which is supposed to be used to
57 > start the program. It contains:
58 >
59 > #!/bin/sh
60 > java -Xmx400M -jar JAlbum.jar
61 >
62 > Does that tell you anything?
63
64 Yes, it does. There's a file called JAlbum.jar which contains the app, and
65 it's location is visible to the script. There's no path so I'm assuming the
66 file is in the current directory.
67
68 A .jar is just a special kind of zip file (much like OOo files are). What's
69 inside it?
70
71 p.s. I don't know how familiar you are with Java's start-up process and how it
72 finds things and how you specify things to find. It's somewhat unusual and
73 many traps exist for the unwary :-)
74
75 --
76 alan dot mckinnon at gmail dot com

Replies

Subject Author
Re: [gentoo-user] ebuild help: java main class? Grant <emailgrant@×××××.com>