Re: [Wicket-user] Get version of Wicket from program
One way I've heard of is to do something along the lines of:- URL url = getClass().getResource( "/wicket/SomeWicketClass.class"); Now url is something like jar:file:/path/to/the/jar!/wicket/SomeWicketClass.class Now you have to simply strip off the !/wicket/... part and replace with !/META-INF/MANIFEST.MF then Manifest manifest = new Manifest(new URL(manifestPath).openStream()); (Something like that, anyway...) On 07/03/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > Basically the way Johan said is the way we retrieve the version of our own > application. > > Our own application tries to retrieve the version number of the war archive, > so that is a different usecase. > > Martijn > > > > On 3/7/06, Maurice Marrink <[EMAIL PROTECTED]> wrote: > > Codesource should never be null, if you class is in a jar file, > > codesource points to the jar. > > else it might point to a directory where your class files can be found > > (or in subdirs thereof). if none of the above is available it will > > point to the classfile itself. > > > > But perhaps Martijn can tell you how he did it, i know he did it for > > our project but can't seem to find where. > > > > Maurice > > > > On 3/7/06, Joni Suominen < [EMAIL PROTECTED]> wrote: > > > On Tue, 2006-03-07 at 10:27 +0100, Juergen Donnerstag wrote: > > > > Do you know how to access that information? How do you get the jar > > > > file name a specific class has been loaded from? > > > > > > > getClass().getProtectionDomain().getCodeSource().getLocation() > gives you > > > the location where the class was loaded from. I don't know in which > > > situations the CodeSource may be null, though. > > > > > > Joni > > > --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
Basically the way Johan said is the way we retrieve the version of our own application.Our own application tries to retrieve the version number of the war archive, so that is a different usecase.Martijn On 3/7/06, Maurice Marrink <[EMAIL PROTECTED]> wrote: Codesource should never be null, if you class is in a jar file,codesource points to the jar.else it might point to a directory where your class files can be found(or in subdirs thereof). if none of the above is available it will point to the classfile itself.But perhaps Martijn can tell you how he did it, i know he did it forour project but can't seem to find where.MauriceOn 3/7/06, Joni Suominen < [EMAIL PROTECTED]> wrote:> On Tue, 2006-03-07 at 10:27 +0100, Juergen Donnerstag wrote:> > Do you know how to access that information? How do you get the jar> > file name a specific class has been loaded from? >> getClass().getProtectionDomain().getCodeSource().getLocation() gives you> the location where the class was loaded from. I don't know in which> situations the CodeSource may be null, though. >> Joni ---> This SF.Net email is sponsored by xPML, a groundbreaking scripting language> that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory!> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>---This SF.Net email is sponsored by xPML, a groundbreaking scripting languagethat extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user-- Living a wicket life...Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1
Re: [Wicket-user] Get version of Wicket from program
Codesource should never be null, if you class is in a jar file, codesource points to the jar. else it might point to a directory where your class files can be found (or in subdirs thereof). if none of the above is available it will point to the classfile itself. But perhaps Martijn can tell you how he did it, i know he did it for our project but can't seem to find where. Maurice On 3/7/06, Joni Suominen <[EMAIL PROTECTED]> wrote: > On Tue, 2006-03-07 at 10:27 +0100, Juergen Donnerstag wrote: > > Do you know how to access that information? How do you get the jar > > file name a specific class has been loaded from? > > getClass().getProtectionDomain().getCodeSource().getLocation() gives you > the location where the class was loaded from. I don't know in which > situations the CodeSource may be null, though. > > Joni > > > > --- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
On Tue, 2006-03-07 at 10:27 +0100, Juergen Donnerstag wrote: > Do you know how to access that information? How do you get the jar > file name a specific class has been loaded from? getClass().getProtectionDomain().getCodeSource().getLocation() gives you the location where the class was loaded from. I don't know in which situations the CodeSource may be null, though. Joni --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
shouldn't wicketservlet.getClass().getResourceAsStream("/META-INF/MANIFEST.MF") work?johanOn 3/7/06, Juergen Donnerstag < [EMAIL PROTECTED]> wrote:Do you know how to access that information? How do you get the jar file name a specific class has been loaded from?JuergenOn 3/7/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote:> The Wicket version is available in the manifest file (it is put there > automatically by maven).>> more MANIFEST.MF> Manifest-Version: 1.0> Ant-Version: Apache Ant 1.6.5> Created-By: Apache Maven> Built-By: martijn> Package: wicket > Build-Jdk: 1.4.2_09> Extension-Name: wicket> Specification-Title: a Java web application framework.> Specification-Vendor: Wicket developers> Implementation-Title: wicket> Implementation-Vendor: Wicket developers > Implementation-Version: 1.2-beta1>> Martijn>>> On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:> > there are a couple of ways we can do this. there is wicket.properties which> > can house a wicket.version property, or we can create something like> >> > public class WickerVersion { public static final String MAJOR="blah"; public > > static final String MINOR="blah"; }> >> > we can use mvn filters to populate the values somehow. martijn do you know> > how we can get the version you are building from mvn script? and how mvn > > filtering works?> >> > which fields would we need? will a simple string do? do we need major/minor?> >> > -Igor> >> >> >> > On 3/6/06, jan_bar < [EMAIL PROTECTED]> wrote:> > > Hi,> > >> > > how can I get Wicket version from my program? Something like:> > >> > > String Application.getVersion()> > >> > > In my opinion this is useful function. For instance when I write> > something,> > > that might not work well in next version of Wicket, I can assert on Wicket > > > version.> > >> > > Thanks, Jan> > >> > >> > >> > >> > >> > > --- > > > This SF.Net email is sponsored by xPML, a groundbreaking scripting> > language> > > that extends applications into web and mobile media. Attend the live> > webcast> > > and join the prime developer group breaking into this new coding > > territory!> > >> > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > > ___> > > Wicket-user mailing list> > > Wicket-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-user> > >> >> --> Living a wicket life... >> Martijn Dashorst - http://www.jroller.com/page/dashorst>> Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 >>> ---> This SF.Net email is sponsored by xPML, a groundbreaking scripting language> that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory!> http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642 > ___> Wicket-user mailing list> Wicket-user@lists.sourceforge.net> https://lists.sourceforge.net/lists/listinfo/wicket-user>---This SF.Net email is sponsored by xPML, a groundbreaking scripting languagethat extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
Do you know how to access that information? How do you get the jar file name a specific class has been loaded from? Juergen On 3/7/06, Martijn Dashorst <[EMAIL PROTECTED]> wrote: > The Wicket version is available in the manifest file (it is put there > automatically by maven). > > more MANIFEST.MF > Manifest-Version: 1.0 > Ant-Version: Apache Ant 1.6.5 > Created-By: Apache Maven > Built-By: martijn > Package: wicket > Build-Jdk: 1.4.2_09 > Extension-Name: wicket > Specification-Title: a Java web application framework. > Specification-Vendor: Wicket developers > Implementation-Title: wicket > Implementation-Vendor: Wicket developers > Implementation-Version: 1.2-beta1 > > Martijn > > > On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > > there are a couple of ways we can do this. there is wicket.properties which > > can house a wicket.version property, or we can create something like > > > > public class WickerVersion { public static final String MAJOR="blah"; public > > static final String MINOR="blah"; } > > > > we can use mvn filters to populate the values somehow. martijn do you know > > how we can get the version you are building from mvn script? and how mvn > > filtering works? > > > > which fields would we need? will a simple string do? do we need major/minor? > > > > -Igor > > > > > > > > On 3/6/06, jan_bar <[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > how can I get Wicket version from my program? Something like: > > > > > > String Application.getVersion() > > > > > > In my opinion this is useful function. For instance when I write > > something, > > > that might not work well in next version of Wicket, I can assert on Wicket > > > version. > > > > > > Thanks, Jan > > > > > > > > > > > > > > > > > > --- > > > This SF.Net email is sponsored by xPML, a groundbreaking scripting > > language > > > that extends applications into web and mobile media. Attend the live > > webcast > > > and join the prime developer group breaking into this new coding > > territory! > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > > ___ > > > Wicket-user mailing list > > > Wicket-user@lists.sourceforge.net > > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > -- > Living a wicket life... > > Martijn Dashorst - http://www.jroller.com/page/dashorst > > Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 > > > --- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmdlnk&kid0944&bid$1720&dat1642 > ___ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
The Wicket version is available in the manifest file (it is put there automatically by maven). more MANIFEST.MF Manifest-Version: 1.0 Ant-Version: Apache Ant 1.6.5 Created-By: Apache Maven Built-By: martijn Package: wicket Build-Jdk: 1.4.2_09 Extension-Name: wicket Specification-Title: a Java web application framework. Specification-Vendor: Wicket developers Implementation-Title: wicket Implementation-Vendor: Wicket developers Implementation-Version: 1.2-beta1 Martijn On 3/7/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote: > there are a couple of ways we can do this. there is wicket.properties which > can house a wicket.version property, or we can create something like > > public class WickerVersion { public static final String MAJOR="blah"; public > static final String MINOR="blah"; } > > we can use mvn filters to populate the values somehow. martijn do you know > how we can get the version you are building from mvn script? and how mvn > filtering works? > > which fields would we need? will a simple string do? do we need major/minor? > > -Igor > > > > On 3/6/06, jan_bar <[EMAIL PROTECTED]> wrote: > > Hi, > > > > how can I get Wicket version from my program? Something like: > > > > String Application.getVersion() > > > > In my opinion this is useful function. For instance when I write > something, > > that might not work well in next version of Wicket, I can assert on Wicket > > version. > > > > Thanks, Jan > > > > > > > > > > > > --- > > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > > that extends applications into web and mobile media. Attend the live > webcast > > and join the prime developer group breaking into this new coding > territory! > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > > ___ > > Wicket-user mailing list > > Wicket-user@lists.sourceforge.net > > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > -- Living a wicket life... Martijn Dashorst - http://www.jroller.com/page/dashorst Wicket 1.1.1 is out: http://wicket.sourceforge.net/wicket-1.1 --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid0944&bid$1720&dat1642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
Re: [Wicket-user] Get version of Wicket from program
there are a couple of ways we can do this. there is wicket.properties which can house a wicket.version property, or we can create something likepublic class WickerVersion { public static final String MAJOR="blah"; public static final String MINOR="blah"; } we can use mvn filters to populate the values somehow. martijn do you know how we can get the version you are building from mvn script? and how mvn filtering works?which fields would we need? will a simple string do? do we need major/minor? -IgorOn 3/6/06, jan_bar <[EMAIL PROTECTED]> wrote: Hi,how can I get Wicket version from my program? Something like:String Application.getVersion()In my opinion this is useful function. For instance when I write something,that might not work well in next version of Wicket, I can assert on Wicket version.Thanks, Jan---This SF.Net email is sponsored by xPML, a groundbreaking scripting languagethat extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory!http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___Wicket-user mailing listWicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user
[Wicket-user] Get version of Wicket from program
Hi, how can I get Wicket version from my program? Something like: String Application.getVersion() In my opinion this is useful function. For instance when I write something, that might not work well in next version of Wicket, I can assert on Wicket version. Thanks, Jan --- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 ___ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user