[opensuse-packaging] How to set javac target ?
Hi I'm wondering how to set the javac target in a specfile. [...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower. BTW, the error message contradicts itself ("later" means "lower" version number?). --> /usr/lib/rpm/brp-check-bytecode-version How to reproduce: osc co home:sndirsch geotag cd home:sndirsch/geotag env -u BUILD_DIST osc build Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Stefan Dirsch [2008-10-27 12:45]:
I'm wondering how to set the javac target in a specfile.
Well, "javac -target 1.5" if you directly invoke the java compiler. If the project is built with Ant, you have to patch build.xml (maybe it works also with build.properties, too long ago), see http://ant.apache.org. Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Stefan Dirsch wrote:
Hi
I'm wondering how to set the javac target in a specfile.
[...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower.
BTW, the error message contradicts itself ("later" means "lower" version number?).
--> /usr/lib/rpm/brp-check-bytecode-version
How to reproduce:
osc co home:sndirsch geotag cd home:sndirsch/geotag env -u BUILD_DIST osc build
Your package only contains already compiled java code in a .jar file, so there is no way to set a java version target. During compilation the java target version can be set with: javac -target 1.5 for example. Greetings -- Thomas Schmidt (tschmidt [at] suse.de) SUSE Linux Products GmbH :: Research & Development :: Tools "Don't Panic", Douglas Adams (1952 - 11.05.2001) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 01:12:35PM +0100, Thomas Schmidt wrote:
Stefan Dirsch wrote:
Hi
I'm wondering how to set the javac target in a specfile.
[...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower.
BTW, the error message contradicts itself ("later" means "lower" version number?).
--> /usr/lib/rpm/brp-check-bytecode-version
How to reproduce:
osc co home:sndirsch geotag cd home:sndirsch/geotag env -u BUILD_DIST osc build
Your package only contains already compiled java code in a .jar file, so there is no way to set a java version target.
Ok. So this basically means that packaging .jar files is impossible using our buildservice. :-( Still the error message is confusing.
During compilation the java target version can be set with: javac -target 1.5 for example.
According to the Geotag website you need eclipse to build the sources. http://geotag.sourceforge.net/?q=node/23 Not sure how this is supposed to work in our buildservice. :-( Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Stefan Dirsch [2008-10-27 14:15]:
Ok. So this basically means that packaging .jar files is impossible using our buildservice. :-( Still the error message is confusing.
Well, I guess it's against our policy to ship "binaries". But the technical benefits of recompiling Java class files are quite small compared to the technical benefits of recompiling machine code.
During compilation the java target version can be set with: javac -target 1.5 for example.
According to the Geotag website you need eclipse to build the sources.
http://geotag.sourceforge.net/?q=node/23
Not sure how this is supposed to work in our buildservice. :-(
Well, I think you don't *need* but he uses it. So, you still can write a custom build.xml for Ant (some "make for java"). But honestly I also would think twice if I would do that ... or just install the software locally. ;) Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 02:26:39PM +0100, Bernhard Walle wrote:
* Stefan Dirsch [2008-10-27 14:15]:
Ok. So this basically means that packaging .jar files is impossible using our buildservice. :-( Still the error message is confusing.
Well, I guess it's against our policy to ship "binaries". But the technical benefits of recompiling Java class files are quite small compared to the technical benefits of recompiling machine code.
During compilation the java target version can be set with: javac -target 1.5 for example.
According to the Geotag website you need eclipse to build the sources.
http://geotag.sourceforge.net/?q=node/23
Not sure how this is supposed to work in our buildservice. :-(
Well, I think you don't *need* but he uses it. So, you still can write a custom build.xml for Ant (some "make for java").
This doesn't look like a low hanging fruit given that I don't have *any* experience WRT writing build.xml files for Ant and the deep directory structure of geotag.
But honestly I also would think twice if I would do that ... or just install the software locally. ;)
Sure, but the idea was to provide a package. I'm considering now to disable this brp-check-bytecode-version check. Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Stefan Dirsch wrote:
On Mon, Oct 27, 2008 at 01:12:35PM +0100, Thomas Schmidt wrote:
Stefan Dirsch wrote:
Hi
I'm wondering how to set the javac target in a specfile.
[...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower.
BTW, the error message contradicts itself ("later" means "lower" version number?).
--> /usr/lib/rpm/brp-check-bytecode-version
How to reproduce:
osc co home:sndirsch geotag cd home:sndirsch/geotag env -u BUILD_DIST osc build Your package only contains already compiled java code in a .jar file, so there is no way to set a java version target.
Ok. So this basically means that packaging .jar files is impossible using our buildservice. :-( Still the error message is confusing.
It would work when the .jar would have been built for Java 1.5 or lower. But anyway it would not be ok I think, because you are packaging a binary only file.
During compilation the java target version can be set with: javac -target 1.5 for example.
According to the Geotag website you need eclipse to build the sources.
http://geotag.sourceforge.net/?q=node/23
Not sure how this is supposed to work in our buildservice. :-(
The advantage of using eclipse is, that it has the junit dependency built in, and can create the jar archive by mouseclick. You can build it manually like this: find . -name \*.java > files sudo zypper in junit mkdir build javac -d build -target 1.5 -nowarn -cp /usr/share/java/junit.jar @files jar -c build > output.jar Greetings -- Thomas Schmidt (tschmidt [at] suse.de) SUSE Linux Products GmbH :: Research & Development :: Tools "Don't Panic", Douglas Adams (1952 - 11.05.2001) -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 03:05:58PM +0100, Thomas Schmidt wrote:
Stefan Dirsch wrote:
On Mon, Oct 27, 2008 at 01:12:35PM +0100, Thomas Schmidt wrote:
Stefan Dirsch wrote:
Hi
I'm wondering how to set the javac target in a specfile.
[...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower.
BTW, the error message contradicts itself ("later" means "lower" version number?).
--> /usr/lib/rpm/brp-check-bytecode-version
How to reproduce:
osc co home:sndirsch geotag cd home:sndirsch/geotag env -u BUILD_DIST osc build Your package only contains already compiled java code in a .jar file, so there is no way to set a java version target.
Ok. So this basically means that packaging .jar files is impossible using our buildservice. :-( Still the error message is confusing.
It would work when the .jar would have been built for Java 1.5 or lower. But anyway it would not be ok I think, because you are packaging a binary only file.
During compilation the java target version can be set with: javac -target 1.5 for example.
According to the Geotag website you need eclipse to build the sources.
http://geotag.sourceforge.net/?q=node/23
Not sure how this is supposed to work in our buildservice. :-(
The advantage of using eclipse is, that it has the junit dependency built in, and can create the jar archive by mouseclick.
You can build it manually like this: find . -name \*.java > files sudo zypper in junit mkdir build javac -d build -target 1.5 -nowarn -cp /usr/share/java/junit.jar @files jar -c build > output.jar
Thanks. Indeed build works fine (but only with SUN Java, which apparently is not available in our buildservice), but trying to run it fails Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar Best regards, Stefan P.S.: Is there a policy, which Java to use for building Java files? Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Stefan Dirsch [2008-10-27 15:55]:
Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar
You have to set the main class in the manifest file, see jar(1). Or call the program with java -cp geotag.java package.and.Class.of.main.method Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Bernhard Walle [2008-10-27 16:02]:
* Stefan Dirsch [2008-10-27 15:55]:
Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar
You have to set the main class in the manifest file, see jar(1). Or call the program with
java -cp geotag.java package.and.Class.of.main.method
^^^ /usr/share/java/geotag.jar Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 04:03:16PM +0100, Bernhard Walle wrote:
* Bernhard Walle [2008-10-27 16:02]:
* Stefan Dirsch [2008-10-27 15:55]:
Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar
You have to set the main class in the manifest file, see jar(1). Or call the program with
java -cp geotag.java package.and.Class.of.main.method
^^^ /usr/share/java/geotag.jar
Thanks. Tried it with java -cp /usr/share/java/geotag.jar org/fibs/geotag/Geotag (which might be the wrong main class; not sure how to figure out the main class of a Java program) and program terminates immediately with exit code 1. Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Stefan Dirsch [2008-10-27 16:39]:
On Mon, Oct 27, 2008 at 04:03:16PM +0100, Bernhard Walle wrote:
* Bernhard Walle [2008-10-27 16:02]:
* Stefan Dirsch [2008-10-27 15:55]:
Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar
You have to set the main class in the manifest file, see jar(1). Or call the program with
java -cp geotag.java package.and.Class.of.main.method
^^^ /usr/share/java/geotag.jar
Thanks. Tried it with
java -cp /usr/share/java/geotag.jar org/fibs/geotag/Geotag
(which might be the wrong main class; not sure how to figure out the main class of a Java program)
Search for 'main (String[] args)'. But I would try org.fibs.geotag.Geotag instead. Regards, Bernhard -- Bernhard Walle, SUSE Linux Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 04:42:02PM +0100, Bernhard Walle wrote:
* Stefan Dirsch [2008-10-27 16:39]:
On Mon, Oct 27, 2008 at 04:03:16PM +0100, Bernhard Walle wrote:
* Bernhard Walle [2008-10-27 16:02]:
* Stefan Dirsch [2008-10-27 15:55]:
Failed to load Main-Class manifest attribute from /usr/share/java/geotag.jar
You have to set the main class in the manifest file, see jar(1). Or call the program with
java -cp geotag.java package.and.Class.of.main.method
^^^ /usr/share/java/geotag.jar
Thanks. Tried it with
java -cp /usr/share/java/geotag.jar org/fibs/geotag/Geotag
(which might be the wrong main class; not sure how to figure out the main class of a Java program)
Search for 'main (String[] args)'.
Looks like I used the right one. ./org/fibs/geotag/Geotag.java: public static void main(String[] args) {
But I would try org.fibs.geotag.Geotag instead.
Same issue. :-( Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Stefan Dirsch [2008-10-27 16:57]:
Looks like I used the right one.
./org/fibs/geotag/Geotag.java: public static void main(String[] args) {
But I would try org.fibs.geotag.Geotag instead.
Same issue. :-(
Here's a build.xml: ---------------------------- 8< --------------------------------------- <?xml version="1.0" encoding="utf-8"?> <project name="GeoTag" default="dist" basedir="."> <description> Build GeoTag </description> <!-- set global properties for this build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <property name="res" location="res" /> <property name="junit" location="/usr/share/java/junit.jar" /> <target name="init"> <mkdir dir="${build}"/> </target> <target name="compile" depends="init" description="Compile the source "> <javac target="1.5" srcdir="${src}" destdir="${build}" classpath="${unit}" /> </target> <target name="dist" depends="compile" description="Generate the distribution"> <mkdir dir="${dist}"/> <jar jarfile="${dist}/GeoTag.jar" manifest="MANIFEST.MF"> <fileset dir="${build}" /> <fileset dir="${src}" excludes="**/*.java" /> <fileset dir="${res}" /> </jar> </target> <target name="clean" description="clean up"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project> ---------------------------- 8< --------------------------------------- Just call "ant" in that directory. Produces a dist/GeoTag.jar that works fine with "java -Xmx256M -jar dist/GeoTag.jar" here. I used Sun JDK 1.6.0_10 to test. BTW: If you start it with -console=yes, then you actually see error output on console. Else the output is redirected to /tmp/Geotag.log. HTH, Regards, Bernhard -- Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
Hi Bernhard, > Just call "ant" in that directory. Produces a dist/GeoTag.jar that > works fine with "java -Xmx256M -jar dist/GeoTag.jar" here. I used Sun > JDK 1.6.0_10 to test. Interesting, where did you get the java update 10? - Yast's package management doesn't show any available java updates. Btw. quite a number of opensuse's java programs are not compiled from source, but just repackaged jar files. also see: http://en.opensuse.org/Java reading the posts, hardly anyone knows about these. And there is also a java software (packaging) issues related mailing list : opensuse-java@opensuse.org thanks, Denny -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
* Denny Beyer [2008-10-27 23:30]:
> Just call "ant" in that directory. Produces a dist/GeoTag.jar that > works fine with "java -Xmx256M -jar dist/GeoTag.jar" here. I used Sun > JDK 1.6.0_10 to test. Interesting, where did you get the java update 10?
http://java.sun.com. That simple. ;) Regards, Bernhard -- Bernhard Walle, SUSE LINUX Products GmbH, Architecture Development -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Tuesday 28 of October 2008 00:30:07 Denny Beyer wrote:
Hi Bernhard,
Btw. quite a number of opensuse's java programs are not compiled from source, but just repackaged jar files. But consider, that this is a bug in many cases :)
Michal Vyskocil -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Mon, Oct 27, 2008 at 09:47:48PM +0100, Bernhard Walle wrote:
* Stefan Dirsch [2008-10-27 16:57]:
Looks like I used the right one.
./org/fibs/geotag/Geotag.java: public static void main(String[] args) {
But I would try org.fibs.geotag.Geotag instead.
Same issue. :-(
Here's a build.xml:
---------------------------- 8< ---------------------------------------
<?xml version="1.0" encoding="utf-8"?> <project name="GeoTag" default="dist" basedir="."> <description> Build GeoTag </description>
<!-- set global properties for this build --> <property name="src" location="src"/> <property name="build" location="build"/> <property name="dist" location="dist"/> <property name="res" location="res" /> <property name="junit" location="/usr/share/java/junit.jar" />
<target name="init"> <mkdir dir="${build}"/> </target>
<target name="compile" depends="init" description="Compile the source "> <javac target="1.5" srcdir="${src}" destdir="${build}" classpath="${unit}" /> </target>
<target name="dist" depends="compile" description="Generate the distribution"> <mkdir dir="${dist}"/> <jar jarfile="${dist}/GeoTag.jar" manifest="MANIFEST.MF"> <fileset dir="${build}" /> <fileset dir="${src}" excludes="**/*.java" /> <fileset dir="${res}" /> </jar> </target>
<target name="clean" description="clean up"> <delete dir="${build}"/> <delete dir="${dist}"/> </target> </project>
---------------------------- 8< ---------------------------------------
Just call "ant" in that directory. Produces a dist/GeoTag.jar that works fine with "java -Xmx256M -jar dist/GeoTag.jar" here. I used Sun JDK 1.6.0_10 to test.
BTW: If you start it with -console=yes, then you actually see error output on console. Else the output is redirected to /tmp/Geotag.log.
Thanks. You've helped me a lot! :-) Best regards, Stefan Public Key available ------------------------------------------------------ Stefan Dirsch (Res. & Dev.) SUSE LINUX Products GmbH Tel: 0911-740 53 0 Maxfeldstraße 5 FAX: 0911-740 53 479 D-90409 Nürnberg http://www.suse.de Germany ----------------------------------------------------------------- SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg) ----------------------------------------------------------------- -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
On Monday 27 of October 2008 12:45:50 Stefan Dirsch wrote:
Hi Hi Stefan,
I'm wondering how to set the javac target in a specfile.
[...] ERROR: the files above contain java bytecode for something later than java 1.5, ERROR: please set the javac target to 1.5 or lower.
BTW, the error message contradicts itself ("later" means "lower" version number?).
--> /usr/lib/rpm/brp-check-bytecode-version
How to reproduce:
You have two possibilities: Type export NO_BRP_CHECK_BYTECODE_VERSION="true" somewhere in %install section. This turn off that test. Use ant -Dant.build.javac.source=1.5 -Dant.build.javac.target=1.5 ... Michal Vyskocil -- To unsubscribe, e-mail: opensuse-packaging+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-packaging+help@opensuse.org
participants (5)
-
Bernhard Walle
-
Denny Beyer
-
Michal Vyskocil
-
Stefan Dirsch
-
Thomas Schmidt