Quantcast

deploying jython : self contained double-clickable windows executable?

classic Classic list List threaded Threaded
15 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

deploying jython : self contained double-clickable windows executable?

mrule
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

Jeff Emanuel
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

Jim Baker
Jeff,

This may not apply to you just yet, but I recently have been working on Clamp, a package that supports this requirement. Clamp - and its name! - builds on earlier work by Darjus Loktevic and Charlie Groves.

Clamp can be found here, https://github.com/jythontools/clamp, with Clamp's usage documented in this demo project: https://github.com/jimbaker/clamped. Although currently you need to use GitHub to access, Clamp will be in PyPI once we have beta 2 of Jython 2.7 out. Jython 2.7b2 in turn requires supporting both pip and and its remaining (somewhat challenging) dependency, nonblocking SSL sockets.

In particular for your use case, Clamp adds a singlejar command to setup.py such that if your code has a __run__.py file, the jar is a single executable. Alternatively, such "uber jars" can be used by frameworks like Storm or Cassandra (specifically triggers). Clamp also covers a bunch of other use cases for Java integration, including being a compelling replacement for the Jython object factory pattern.

- Jim


On Fri, Dec 6, 2013 at 9:14 AM, Jeff Emanuel <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.




On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
In reply to this post by Jeff Emanuel
Although I got the classpath version working nicely, I decided to move ahead to try to package everything in a single Jar file. I ran into some things that confused me:

-- it seemed like Jython would only find auxillary Java classes if they were in their own package, and that package was part of com or org

-- there doesn't seem to be an easy way to pack resources for Jython in the Jar. The usual Java solution is something like class.getResource, but I couldn't figure out how to use that From jython. What I ended up doing is ... not great, which is create a Resource package in Java with a class called Resources that contains a single static method which wraps the class.getResource functionality. 

I'm sure I just haven't read the right documentation to know how to do this correctly, but I thought I should make a note of this.






On Fri, Dec 6, 2013 at 11:17 AM, Jeff Emanuel [via Python] <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users



If you reply to this email, your message will be added to the discussion below:
http://python.6.x6.nabble.com/deploying-jython-self-contained-double-clickable-windows-executable-tp5041075p5041077.html
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
Another think which I am trying to understand: once packaged, we invoke the JAR as

java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

My impression was that the "org.python.util.jython" in this line was for specifying the main class, but

If I specify the main class in the manifest like so
Main-Class: org.python.util.jython

and then run 
java -jar ./myapp.jar

I just get the Jython interpreter, instead of the app as defined in __run__,py loading.




On Fri, Dec 6, 2013 at 7:28 PM, mrule <[hidden email]> wrote:
Although I got the classpath version working nicely, I decided to move ahead to try to package everything in a single Jar file. I ran into some things that confused me:

-- it seemed like Jython would only find auxillary Java classes if they were in their own package, and that package was part of com or org

-- there doesn't seem to be an easy way to pack resources for Jython in the Jar. The usual Java solution is something like class.getResource, but I couldn't figure out how to use that From jython. What I ended up doing is ... not great, which is create a Resource package in Java with a class called Resources that contains a single static method which wraps the class.getResource functionality. 

I'm sure I just haven't read the right documentation to know how to do this correctly, but I thought I should make a note of this.






On Fri, Dec 6, 2013 at 11:17 AM, Jeff Emanuel [via Python] <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML



View this message in context: Re: deploying jython : self contained double-clickable windows executable?
Sent from the jython-users mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users



------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
Interesting, when I try to run the packaged Jar in windows, I get the following error:

java.lang.NoClassDefFoundError: IllegalName: org.python.proxies../myapp.jar$WatermarkView$8
        at java.lang.ClassLoader.preDefineClass(Unknown Source)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:52)
        at org.python.core.MakeProxies.makeClass(MakeProxies.java:30)
        at org.python.core.MakeProxies.makeProxy(MakeProxies.java:92)
        at org.python.core.PyType.setupProxy(PyType.java:646)
        at org.python.core.PyType.newType(PyType.java:210)
        at org.python.core.PyType.type___new__(PyType.java:152)
        at org.python.core.PyType$exposed___new__.new_impl(Unknown Source)
        at org.python.core.PyType.invokeNew(PyType.java:480)
        at org.python.core.PyType.type___call__(PyType.java:1638)
        at org.python.core.PyType.__call__(PyType.java:1628)
        at org.python.core.PyObject.__call__(PyObject.java:438)
        at org.python.core.Py.makeClass(Py.java:1680)
        at org.python.core.Py.makeClass(Py.java:1641)
        at org.python.core.Py.makeClass(Py.java:1633)
        at org.python.pycode._pyx0.f$0(__run__:344)
        at org.python.pycode._pyx0.call_function(__run__)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1302)
        at org.python.util.jython.runJar(jython.java:128)
        at org.python.util.jython.run(jython.java:279)
        at org.python.util.jython.main(jython.java:137)



On Fri, Dec 6, 2013 at 7:48 PM, M.Rule <[hidden email]> wrote:
Another think which I am trying to understand: once packaged, we invoke the JAR as

java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

My impression was that the "org.python.util.jython" in this line was for specifying the main class, but

If I specify the main class in the manifest like so
Main-Class: org.python.util.jython

and then run 
java -jar ./myapp.jar

I just get the Jython interpreter, instead of the app as defined in __run__,py loading.




On Fri, Dec 6, 2013 at 7:28 PM, mrule <[hidden email]> wrote:
Although I got the classpath version working nicely, I decided to move ahead to try to package everything in a single Jar file. I ran into some things that confused me:

-- it seemed like Jython would only find auxillary Java classes if they were in their own package, and that package was part of com or org

-- there doesn't seem to be an easy way to pack resources for Jython in the Jar. The usual Java solution is something like class.getResource, but I couldn't figure out how to use that From jython. What I ended up doing is ... not great, which is create a Resource package in Java with a class called Resources that contains a single static method which wraps the class.getResource functionality. 

I'm sure I just haven't read the right documentation to know how to do this correctly, but I thought I should make a note of this.






On Fri, Dec 6, 2013 at 11:17 AM, Jeff Emanuel [via Python] <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users




------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
Please disregard that error relating to "proxies", it is not reproducible.

I was looking at http://launch4j.sourceforge.net/
this looks like a useful tool for packaging Jar files.

The only problem is that I don't think it works with the JARs built following the tutorial at  https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts

The command needed to run those JARs is something like
java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

To get a true click-to-launch JAR in Windows, and to use programs like launch4j which can bundle executables, I suspect that we need to make a JAR that can be invoked like this

java -jar myapp.jar

So far, I haven't figured out how to do this. If the Python source is _outside_ the JAR file, we can pass it as a command line argument, but if the Python source is _inside_ using the "__run__.py" approach, I'm at a loss. It doesn't seem like the tutorial covers this case.

Any leads?

Best,
Michael.


On Fri, Dec 6, 2013 at 7:57 PM, M.Rule <[hidden email]> wrote:
Interesting, when I try to run the packaged Jar in windows, I get the following error:

java.lang.NoClassDefFoundError: IllegalName: org.python.proxies../myapp.jar$WatermarkView$8
        at java.lang.ClassLoader.preDefineClass(Unknown Source)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:52)
        at org.python.core.MakeProxies.makeClass(MakeProxies.java:30)
        at org.python.core.MakeProxies.makeProxy(MakeProxies.java:92)
        at org.python.core.PyType.setupProxy(PyType.java:646)
        at org.python.core.PyType.newType(PyType.java:210)
        at org.python.core.PyType.type___new__(PyType.java:152)
        at org.python.core.PyType$exposed___new__.new_impl(Unknown Source)
        at org.python.core.PyType.invokeNew(PyType.java:480)
        at org.python.core.PyType.type___call__(PyType.java:1638)
        at org.python.core.PyType.__call__(PyType.java:1628)
        at org.python.core.PyObject.__call__(PyObject.java:438)
        at org.python.core.Py.makeClass(Py.java:1680)
        at org.python.core.Py.makeClass(Py.java:1641)
        at org.python.core.Py.makeClass(Py.java:1633)
        at org.python.pycode._pyx0.f$0(__run__:344)
        at org.python.pycode._pyx0.call_function(__run__)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1302)
        at org.python.util.jython.runJar(jython.java:128)
        at org.python.util.jython.run(jython.java:279)
        at org.python.util.jython.main(jython.java:137)



On Fri, Dec 6, 2013 at 7:48 PM, M.Rule <[hidden email]> wrote:
Another think which I am trying to understand: once packaged, we invoke the JAR as

java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

My impression was that the "org.python.util.jython" in this line was for specifying the main class, but

If I specify the main class in the manifest like so
Main-Class: org.python.util.jython

and then run 
java -jar ./myapp.jar

I just get the Jython interpreter, instead of the app as defined in __run__,py loading.




On Fri, Dec 6, 2013 at 7:28 PM, mrule <[hidden email]> wrote:
Although I got the classpath version working nicely, I decided to move ahead to try to package everything in a single Jar file. I ran into some things that confused me:

-- it seemed like Jython would only find auxillary Java classes if they were in their own package, and that package was part of com or org

-- there doesn't seem to be an easy way to pack resources for Jython in the Jar. The usual Java solution is something like class.getResource, but I couldn't figure out how to use that From jython. What I ended up doing is ... not great, which is create a Resource package in Java with a class called Resources that contains a single static method which wraps the class.getResource functionality. 

I'm sure I just haven't read the right documentation to know how to do this correctly, but I thought I should make a note of this.






On Fri, Dec 6, 2013 at 11:17 AM, Jeff Emanuel [via Python] <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users





------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
Nevermind, it is all down there at the very end of the tutorial -- I didn't realize there was more. I think my next step will be to try to build a version of the Jython standalone Jar to target earlier Java versions ( mostly because macs  can't always update to the latest Java version without purchasing the next OS revision )


On Fri, Dec 6, 2013 at 9:46 PM, M.Rule <[hidden email]> wrote:
Please disregard that error relating to "proxies", it is not reproducible.

I was looking at http://launch4j.sourceforge.net/
this looks like a useful tool for packaging Jar files.

The only problem is that I don't think it works with the JARs built following the tutorial at  https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts

The command needed to run those JARs is something like

java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

To get a true click-to-launch JAR in Windows, and to use programs like launch4j which can bundle executables, I suspect that we need to make a JAR that can be invoked like this

java -jar myapp.jar

So far, I haven't figured out how to do this. If the Python source is _outside_ the JAR file, we can pass it as a command line argument, but if the Python source is _inside_ using the "__run__.py" approach, I'm at a loss. It doesn't seem like the tutorial covers this case.

Any leads?

Best,
Michael.


On Fri, Dec 6, 2013 at 7:57 PM, M.Rule <[hidden email]> wrote:
Interesting, when I try to run the packaged Jar in windows, I get the following error:

java.lang.NoClassDefFoundError: IllegalName: org.python.proxies../myapp.jar$WatermarkView$8
        at java.lang.ClassLoader.preDefineClass(Unknown Source)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at org.python.core.BytecodeLoader$Loader.loadClassFromBytes(BytecodeLoader.java:119)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:37)
        at org.python.core.BytecodeLoader.makeClass(BytecodeLoader.java:52)
        at org.python.core.MakeProxies.makeClass(MakeProxies.java:30)
        at org.python.core.MakeProxies.makeProxy(MakeProxies.java:92)
        at org.python.core.PyType.setupProxy(PyType.java:646)
        at org.python.core.PyType.newType(PyType.java:210)
        at org.python.core.PyType.type___new__(PyType.java:152)
        at org.python.core.PyType$exposed___new__.new_impl(Unknown Source)
        at org.python.core.PyType.invokeNew(PyType.java:480)
        at org.python.core.PyType.type___call__(PyType.java:1638)
        at org.python.core.PyType.__call__(PyType.java:1628)
        at org.python.core.PyObject.__call__(PyObject.java:438)
        at org.python.core.Py.makeClass(Py.java:1680)
        at org.python.core.Py.makeClass(Py.java:1641)
        at org.python.core.Py.makeClass(Py.java:1633)
        at org.python.pycode._pyx0.f$0(__run__:344)
        at org.python.pycode._pyx0.call_function(__run__)
        at org.python.core.PyTableCode.call(PyTableCode.java:165)
        at org.python.core.PyCode.call(PyCode.java:18)
        at org.python.core.Py.runCode(Py.java:1302)
        at org.python.util.jython.runJar(jython.java:128)
        at org.python.util.jython.run(jython.java:279)
        at org.python.util.jython.main(jython.java:137)



On Fri, Dec 6, 2013 at 7:48 PM, M.Rule <[hidden email]> wrote:
Another think which I am trying to understand: once packaged, we invoke the JAR as

java -cp ./myapp.jar org.python.util.jython -jar myapp.jar

My impression was that the "org.python.util.jython" in this line was for specifying the main class, but

If I specify the main class in the manifest like so
Main-Class: org.python.util.jython

and then run 
java -jar ./myapp.jar

I just get the Jython interpreter, instead of the app as defined in __run__,py loading.




On Fri, Dec 6, 2013 at 7:28 PM, mrule <[hidden email]> wrote:
Although I got the classpath version working nicely, I decided to move ahead to try to package everything in a single Jar file. I ran into some things that confused me:

-- it seemed like Jython would only find auxillary Java classes if they were in their own package, and that package was part of com or org

-- there doesn't seem to be an easy way to pack resources for Jython in the Jar. The usual Java solution is something like class.getResource, but I couldn't figure out how to use that From jython. What I ended up doing is ... not great, which is create a Resource package in Java with a class called Resources that contains a single static method which wraps the class.getResource functionality. 

I'm sure I just haven't read the right documentation to know how to do this correctly, but I thought I should make a note of this.






On Fri, Dec 6, 2013 at 11:17 AM, Jeff Emanuel [via Python] <[hidden email]> wrote:
Re-zip it using "jar".  You need to make sure to tell jar about the manifest file.



On 12/6/2013 8:46 AM, M.Rule wrote:
Hi all,

I'd like to package a Jython program as a self-contained Windows executable. This is a small project for a user-base that cannot be expected to install/configure Java or Jython, it needs to be really simple. So I guess that means that Jython and Java will be bundled with the application ( much like ImageJ ).

I've been pretty confused about how to "deploy" jython. Yesterday, I tried following this https://wiki.python.org/jython/JythonFaq/DistributingJythonScripts. I got to the point where the tutorial seemed to be asking that I unzip the stand-alone Jython jar, add my project files, re-zip it, and things should work. The only thing is, as soon as I unzip-rezip the stand-alone Jython jar, it breaks ( even if I do not modify its contents ), and Java no longer recognizes it as a valid Jar file.

So, that tutorial doesn't work for me.  It also doesn't get me all the way to a self-contained Windows executable. Does anyone have any leads?

Best, Michael.


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK 
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk


_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML


------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users






------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

Fernando Cassia
In reply to this post by mrule
On Fri, Dec 6, 2013 at 12:46 PM, M.Rule <[hidden email]> wrote:
> I'd like to package a Jython program as a self-contained Windows executable.

This, while technically possible, is truly awful and negates the main
advantage of writing Java based apps: cross platform running of a .jar
application.

> This is a small project for a user-base that cannot be expected to
> install/configure Java or Jython, it needs to be really simple

Java can be installed effortlessly (on Windows and OSX). And OpenJDK 7
comes with almost all the Linux versions out there.
Java needs no "configuration" on the user side, neither does Jython.

The second part of your question, packaging Jython along with your
app, can be accomplished (I guess, never tried, but I see no reason
why it shouldn't work like any other JAR) by using OneJAR...

http://one-jar.sourceforge.net/
FC
--
During times of Universal Deceit, telling the truth becomes a revolutionary act
Durante épocas de Engaño Universal, decir la verdad se convierte en un
Acto Revolucionario
- George Orwell

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

Fernando Cassia
In reply to this post by mrule
On Sat, Dec 7, 2013 at 1:20 AM, M.Rule <[hidden email]> wrote:
> I think my next step will be to try to build a version of the Jython
> standalone Jar to target earlier Java versions ( mostly because macs  can't
> always update to the latest Java version without purchasing the next OS
> revision )


That would be great. "Download cross platform.JAR (for all OSs with
java)" is what the Java based
Vuze P2P client does (in addition to the .exe for WinXX systems).

FC

--
During times of Universal Deceit, telling the truth becomes a revolutionary act
Durante épocas de Engaño Universal, decir la verdad se convierte en un
Acto Revolucionario
- George Orwell

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

Fernando Cassia
In reply to this post by Fernando Cassia
On Sat, Dec 7, 2013 at 10:18 AM, M.Rule <[hidden email]> wrote:
>
> I think ImageJ's deployment approach is tolerable : they provide bundled
> Java for users who are afriad of installing Java, but also just provide the
> source and/or Jar for more advanced users.

Indeed. That is a good solution to cover all bases and please everyone.

FC

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
It looks like I will have a lot of trouble building Jython from source -- I am not familiar with the ant build tools, and I am not prepared to debug errors related to building Jython. Does anyone have a version of the Jython class files that have been compiled to be backwards compatible with earlier versions of Java? The more backwards compatible the better, although I'd settle for something compatible with the earlier versions of Java 2


On Sat, Dec 7, 2013 at 8:26 AM, Fernando Cassia [via Python] <[hidden email]> wrote:
On Sat, Dec 7, 2013 at 10:18 AM, M.Rule <[hidden email]> wrote:
>
> I think ImageJ's deployment approach is tolerable : they provide bundled
> Java for users who are afriad of installing Java, but also just provide the
> source and/or Jar for more advanced users.

Indeed. That is a good solution to cover all bases and please everyone.

FC

------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users



If you reply to this email, your message will be added to the discussion below:
http://python.6.x6.nabble.com/deploying-jython-self-contained-double-clickable-windows-executable-tp5041075p5041156.html
To start a new topic under jython-users, email [hidden email]
To unsubscribe from jython-users, click here.
NAML

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
Well, I guess I'm going to press on with trying to build Jython for compatibility with earlier versions of Java. I'm on linux ( ubuntu ). I'm completely unfamiliar with these particular tools. So far,

I've downloaded the latest Jython source posted on http://www.jython.org/downloads.html

I've installed "ant" and "antlr3" using apt-get.
At first, I got a NoClassDefFoundError for org.antlr.Tool, which was solved by export CLASSPATH="$CLASSPATH:/usr/share/java/*"

So now, I can call
$ ant developer-build

and it at least tries to build, but I get a lot of errors like

package javax.servlet does not exist
package org.antlr.runtime does not exist
cannot find symbol
    [javac] symbol  : class ParserRuleReturnScope
...

So presumably $CLASSPATH is set up well enough for ANT to run, but not correctly, since these various libraries aren't found during compilation?
I'll keep working on this but it will probably take me a bit of time to learn all of the tools.





------------------------------------------------------------------------------
Sponsored by Intel(R) XDK
Develop, test and display web and hybrid apps with a single code base.
Download it for free now!
http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

mrule
It works fine, the only thing is I get this error every time my application loads:

Exception in thread "main" Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "<string>", line 3, in <module>
AttributeError: 'module' object has no attribute 'main'


It doesn't seem like the traceback is informative enough for me to even tell where the error is coming from. This error also doesn't seem to matter -- everything loads and runs fine, as far as I can tell.
I was just curious whether anyone had any idea where this error was coming from?



On Sat, Dec 7, 2013 at 10:25 AM, M.Rule <[hidden email]> wrote:
Well, I guess I'm going to press on with trying to build Jython for compatibility with earlier versions of Java. I'm on linux ( ubuntu ). I'm completely unfamiliar with these particular tools. So far,

I've downloaded the latest Jython source posted on http://www.jython.org/downloads.html

I've installed "ant" and "antlr3" using apt-get.
At first, I got a NoClassDefFoundError for org.antlr.Tool, which was solved by export CLASSPATH="$CLASSPATH:/usr/share/java/*"

So now, I can call
$ ant developer-build

and it at least tries to build, but I get a lot of errors like

package javax.servlet does not exist
package org.antlr.runtime does not exist
cannot find symbol
    [javac] symbol  : class ParserRuleReturnScope
...

So presumably $CLASSPATH is set up well enough for ANT to run, but not correctly, since these various libraries aren't found during compilation?
I'll keep working on this but it will probably take me a bit of time to learn all of the tools.






------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: deploying jython : self contained double-clickable windows executable?

chai ang-2
In reply to this post by mrule
>    3. Re: deploying jython : self contained double-clickable
>       windows executable? (M.Rule)



Not sure if this has been pointed out yet but this post

http://stackoverflow.com/questions/1252965/distributing-my-python-scripts-as-jars-with-jython

was useful to me.

I followed the instructions here and have none of the issues I see you having.

ie.
prepare your manifest file
eg manifest.mf
Main-Class: org.python.util.JarRunner
Class-Path: .  lib/slf4j-api-1.6.1.jar

do the
jar ufm your-jython-dist.jar manifest.mf

then jar up your __run__.py

jar uvf your-jython-dist.jar __run__.py

And that's it. This way seems to be problem free for me.

Hope this helps.

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
Jython-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jython-users
Loading...