Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.maint.java > #11973 > unrolled thread
| Started by | Roger Shimizu <rosh@debian.org> |
|---|---|
| First post | 2020-12-07 18:00 +0100 |
| Last post | 2020-12-13 10:20 +0100 |
| Articles | 6 — 3 participants |
Back to article view | Back to linux.debian.maint.java
Ask for help on new pkg xperia-flashtool on classpath Roger Shimizu <rosh@debian.org> - 2020-12-07 18:00 +0100
Re: Ask for help on new pkg xperia-flashtool on classpath Thorsten Glaser <t.glaser@tarent.de> - 2020-12-07 18:10 +0100
Re: Ask for help on new pkg xperia-flashtool on classpath Roger Shimizu <rosh@debian.org> - 2020-12-07 18:20 +0100
Re: Ask for help on new pkg xperia-flashtool on classpath Thorsten Glaser <t.glaser@tarent.de> - 2020-12-07 18:40 +0100
Re: Ask for help on new pkg xperia-flashtool on classpath Roger Shimizu <rosh@debian.org> - 2020-12-09 18:30 +0100
Re: Ask for help on new pkg xperia-flashtool on classpath 殷啟聰 | Kai-Chung Yan <seamlik@debian.org> - 2020-12-13 10:20 +0100
| From | Roger Shimizu <rosh@debian.org> |
|---|---|
| Date | 2020-12-07 18:00 +0100 |
| Subject | Ask for help on new pkg xperia-flashtool on classpath |
| Message-ID | <Bjs1J-27P-27@gated-at.bofh.it> |
Dear java and mentors list,
Thanks to ftpmaster's effort and efficiency, my package
xperia-flashtool and all its dependencies all hit unstable lately.
(PS. xperia-flashtool is the open source ROM image flashing tool for
xperia phone.)
However the pkg still cannot be used due to classpath issue, I guess.
After installing xperia-flashtool, and run java command, it report error:
====
$ java -jar /usr/share/xperia-flashtool/x10flasher.jar
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/logging/log4j/core/config/ConfigurationSource
at gui.Main.run(Unknown Source)
at gui.Main.main(Unknown Source)
Caused by: java.lang.ClassNotFoundException:
org.apache.logging.log4j.core.config.ConfigurationSource
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
====
I tried to add classpath, such as"-cp /usr/share/java/log4j-core.jar",
but all failed.
I guess there's classpath issue either on building, or runtime, or both.
Could anyone kindly help me out?
The git repo locates at:
- https://salsa.debian.org/java-team/xperia-flashtool
Thanks in advance!
Cheers,
--
Roger Shimizu, GMT +9 Tokyo
PGP/GPG: 4096R/6C6ACD6417B3ACB1
[toc] | [next] | [standalone]
| From | Thorsten Glaser <t.glaser@tarent.de> |
|---|---|
| Date | 2020-12-07 18:10 +0100 |
| Message-ID | <Bjsbo-2sm-7@gated-at.bofh.it> |
| In reply to | #11973 |
On Tue, 8 Dec 2020, Roger Shimizu wrote: > However the pkg still cannot be used due to classpath issue, I guess. > After installing xperia-flashtool, and run java command, it report error: > > ==== > $ java -jar /usr/share/xperia-flashtool/x10flasher.jar > I tried to add classpath, such as"-cp /usr/share/java/log4j-core.jar", This is really tricky. Due to a shortcoming in Java™, you cannot use both -cp (to set the classpath) and -jar (to run a JAR file). Rather, you’ll have to set the classpath to the dependencies *and* your JAR file, and run the main class with it, so something like… best to put it into a shell script to launch: #!/bin/sh java -cp /usr/share/xperia-flashtool/x10flasher.jar:/usr/share/java/log4j-core.jar:$more_dependencies gui.Main "$@" The “gui.Main” is the entry point which “java -jar” finds automatically; you get it by looking into the JAR file as if it were a PKZIP archive, extracting the META-INF/MANIFEST.MF file and looking at the “Main-Class:” entry therein. HTH & HAND, //mirabilos -- tarent solutions GmbH Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/ Tel: +49 228 54881-393 • Fax: +49 228 54881-235 HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941 Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg ************************************************* Mit unserem Consulting bieten wir Unternehmen maßgeschneiderte Angebote in Form von Beratung, Trainings sowie Workshops in den Bereichen Softwaretechnologie, IT Strategie und Architektur, Innovation und Umsetzung sowie Agile Organisation. Besuchen Sie uns auf https://www.tarent.de/consulting . Wir freuen uns auf Ihren Kontakt. *************************************************
[toc] | [prev] | [next] | [standalone]
| From | Roger Shimizu <rosh@debian.org> |
|---|---|
| Date | 2020-12-07 18:20 +0100 |
| Message-ID | <Bjsl4-2vU-7@gated-at.bofh.it> |
| In reply to | #11974 |
On Tue, Dec 8, 2020 at 2:01 AM Thorsten Glaser <t.glaser@tarent.de> wrote: > > On Tue, 8 Dec 2020, Roger Shimizu wrote: > > > However the pkg still cannot be used due to classpath issue, I guess. > > After installing xperia-flashtool, and run java command, it report error: > > > > ==== > > $ java -jar /usr/share/xperia-flashtool/x10flasher.jar > > > I tried to add classpath, such as"-cp /usr/share/java/log4j-core.jar", > > This is really tricky. Due to a shortcoming in Java™, you > cannot use both -cp (to set the classpath) and -jar (to > run a JAR file). > > Rather, you’ll have to set the classpath to the dependencies > *and* your JAR file, and run the main class with it, so > something like… best to put it into a shell script to launch: > > #!/bin/sh > java -cp /usr/share/xperia-flashtool/x10flasher.jar:/usr/share/java/log4j-core.jar:$more_dependencies gui.Main "$@" Thanks for the hint! Below command already shows different a classpath error, so it's moved forward. $ java -cp /usr/share/xperia-flashtool/x10flasher.jar:/usr/share/java/log4j-core.jar:/usr/share/java/log4j-api.jar gui.Main > The “gui.Main” is the entry point which “java -jar” finds > automatically; you get it by looking into the JAR file as > if it were a PKZIP archive, extracting the META-INF/MANIFEST.MF > file and looking at the “Main-Class:” entry therein. Yes, it set up by build.xml of ant. So my next question is, how to figure out all the classpath, since this package really depends on a lot of java libraries. I tried to set up the classpath automatically by patch, which seems failed: * https://salsa.debian.org/java-team/xperia-flashtool/-/blob/master/debian/patches/02-classpath.patch Cheers, -- Roger Shimizu, GMT +9 Tokyo PGP/GPG: 4096R/6C6ACD6417B3ACB1
[toc] | [prev] | [next] | [standalone]
| From | Thorsten Glaser <t.glaser@tarent.de> |
|---|---|
| Date | 2020-12-07 18:40 +0100 |
| Message-ID | <BjsEp-2Dj-11@gated-at.bofh.it> |
| In reply to | #11975 |
On Tue, 8 Dec 2020, Roger Shimizu wrote: > So my next question is, how to figure out all the classpath, since > this package really depends on a lot of java libraries. I noticed that the MANIFEST file also contains a large list of Classpath entries. I think if you take all these and substitute the absolute pathnames for each of them, you’ll be set. This can probably be automated. > I tried to set up the classpath automatically by patch, which seems failed: > * https://salsa.debian.org/java-team/xperia-flashtool/-/blob/master/debian/patches/02-classpath.patch Sorry, never done that so no idea. bye, //mirabilos -- tarent solutions GmbH Rochusstraße 2-4, D-53123 Bonn • http://www.tarent.de/ Tel: +49 228 54881-393 • Fax: +49 228 54881-235 HRB 5168 (AG Bonn) • USt-ID (VAT): DE122264941 Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg ************************************************* Mit unserem Consulting bieten wir Unternehmen maßgeschneiderte Angebote in Form von Beratung, Trainings sowie Workshops in den Bereichen Softwaretechnologie, IT Strategie und Architektur, Innovation und Umsetzung sowie Agile Organisation. Besuchen Sie uns auf https://www.tarent.de/consulting . Wir freuen uns auf Ihren Kontakt. *************************************************
[toc] | [prev] | [next] | [standalone]
| From | Roger Shimizu <rosh@debian.org> |
|---|---|
| Date | 2020-12-09 18:30 +0100 |
| Message-ID | <BkbrP-5v8-9@gated-at.bofh.it> |
| In reply to | #11977 |
Dear Thorsten, Thanks for your kind hint and help! Problem resolved, and I just uploaded the -2 version. On Tue, Dec 8, 2020 at 2:32 AM Thorsten Glaser <t.glaser@tarent.de> wrote: > > On Tue, 8 Dec 2020, Roger Shimizu wrote: > > > So my next question is, how to figure out all the classpath, since > > this package really depends on a lot of java libraries. > > I noticed that the MANIFEST file also contains a large list of > Classpath entries. I think if you take all these and substitute > the absolute pathnames for each of them, you’ll be set. This can > probably be automated. Yes, actually the large list of classpath is generated automatically from the patch below. I referred the manual to patch this part: - https://ant.apache.org/manual/Tasks/manifestclasspath.html > > I tried to set up the classpath automatically by patch, which seems failed: > > * https://salsa.debian.org/java-team/xperia-flashtool/-/blob/master/debian/patches/02-classpath.patch Cheers, -- Roger Shimizu, GMT +9 Tokyo PGP/GPG: 4096R/6C6ACD6417B3ACB1
[toc] | [prev] | [next] | [standalone]
| From | 殷啟聰 | Kai-Chung Yan <seamlik@debian.org> |
|---|---|
| Date | 2020-12-13 10:20 +0100 |
| Message-ID | <BlvHP-5ds-1@gated-at.bofh.it> |
| In reply to | #11987 |
[Multipart message — attachments visible in raw view] — view raw
Roger Shimizu 於 2020/12/10 上午1:27 寫道: > Dear Thorsten, > > Thanks for your kind hint and help! > Problem resolved, and I just uploaded the -2 version. Glad to hear it's solved! Just a personal opinion: Setting the classpath in the manifest seems inflexible to me because there is no way (at least not that I'm aware of) to tell JRE not to load the classpath set in the manifest. Kind of like the "SONAME" concept in a native library. In time, you might find it confusing when some dependency problem shows up again (e.g. loading 2 JARs with same classes). By not setting the classpath inside a JAR, it becomes more portable without being just an artifact in a distro. If I were you, I would prefer setting the classpath somewhere else and tell the launcher script to use it.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.maint.java
csiph-web