From: Carlos Q. <car...@we...> - 2001-09-06 22:48:48
|
Hi folks I'd like to add the option to install jython in my jEdit plug in, which embeds jython into the editor. Although I can easily add jython.jar I would like to also includes the Lib dir. On the other hand users that already have jython may want no to install it by default, so an optional action is required. I'd like to be able to start the installer from inside the Java Program Is that possible? I've tried to do this jython-21a3.main(args) But this is not possible to compile. How can I proceed? Regards |
From: <bc...@wo...> - 2001-09-07 06:00:07
|
[Carlos Quiroz] >Hi folks > >I'd like to add the option to install jython in my jEdit plug in, which >embeds jython into the editor. Although I can easily add jython.jar I would >like to also includes the Lib dir. On the other hand users that already have >jython may want no to install it by default, so an optional action is >required. I'd like to be able to start the installer from inside the Java >Program > >Is that possible? >I've tried to do this > >jython-21a3.main(args) > >But this is not possible to compile. Due to an unfortunate name of the class. I simply didn't consider this situation when I picked that name. >How can I proceed? First you have to understand that jython-21a3.class is both a class file and a .jar file and for this purpose you have to see it only as a jar file. You start by adding jython-21a3.class to your CLASSPATH or through your own class loader. classpath=d:\java\jdk1.4\jre\lib\rt.jar;jython-21a3.class The you can start the installer with: public static void main(String[] args) { new net.sourceforge.liftoff.installer.Install2(args); } I'll refer you to the liftoff sources for the details of programmaticly choosing a destination dir and which bundles to install: > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/liftoff/liftoff/src/installer/net/sourceforge/liftoff/installer/Install2.java?rev=HEAD&content-type=text/vnd.viewcvs-markup regards, finn |
From: Carlos Q. <car...@rt...> - 2001-09-07 10:47:43
|
On Friday 07 September 2001 09:02, Finn Bock wrote: > Due to an unfortunate name of the class. I simply didn't consider this > situation when I picked that name. > > >How can I proceed? > > First you have to understand that jython-21a3.class is both a class file > and a .jar file and for this purpose you have to see it only as a jar > file. > > You start by adding jython-21a3.class to your CLASSPATH or through your > own class loader. I noticed that you could also change the extension to .jar and it will work just fine. Maybe it would be easier for everybody to use it as a jar and have a MANIFEST file there > > http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/liftoff/liftoff/src/instal > >ler/net/sourceforge/liftoff/installer/Install2.java?rev=HEAD&content-type= > >text/vnd.viewcvs-markup It would be very nice to have a repository from where you could download the latest jython or Lib files and install them locally. Just an idea Regards |
From: Carlos Q. <car...@rt...> - 2001-09-07 14:07:34
|
On Friday 07 September 2001 09:02, Finn Bock wrote: > [Carlos Quiroz] Hi Now everything is almost working but.... The installer has several System.exit(o) calls, that kill my embedded application :-( Any ideas? |
From: Kevin B. <kb...@ca...> - 2001-09-07 18:42:38
|
Carlos Quiroz wrote: > > On Friday 07 September 2001 09:02, Finn Bock wrote: > > [Carlos Quiroz] > > Hi > > Now everything is almost working but.... > > The installer has several System.exit(o) calls, that kill my embedded > application :-( Well, one thing you can do is install a security manager that will ignore the System.exit() calls (see below). You can get lots fancier, and check the context of the call, etc., but this should prevent the exit from occurring. Unfortunately, it will throw a SecurityException in the thread that calls System.exit(). This is reasonable (you don't want the installer thread processing any code after it tried to call exit, do you?), but it means the code that calls the installer will have to handle the exception, and that if something between your code and the call to System.exit() hides the exception, you don't know what will happen. I know some servlet containers, etc., make System.exit() a no-op, but I'm not sure how they manage that, and not sure you'd like that anyway: if beSafe: System.exit(1) doSomethingDangerous() :-) kb --- from java.security import * from java.lang import * class SM( SecurityManager ): def __init__( self, delegate ): self.allowExit = 0 self.delegate = delegate def checkExit( self, status ): if self.allowExit: SecurityManager.checkExit( self, status ) else: raise SecurityException( "Not allowed to exit at this time" ) def checkPermission( self, perm, context=None ): if self.delegate: #allow anything if we don't have a delegate if context: self.delegate.checkPermission( self, perm ) else: self.delegate.checkPermission( self, perm, context ) sec = System.getSecurityManager() sm = SM( sec ) System.setSecurityManager( sm ) try: System.exit(0) except: print "not allowed to exit" print "Did not exit" System.setSecurityManager( sec ) # replace original security manager, or could just set allowExit print "Trying to exit again" System.exit(0) print "You won't see this" --- |
From: Carlos Q. <car...@we...> - 2001-09-09 16:13:05
|
Unfortunately this doesn't work either. My application is a plugin enclosed in another application which already has a security manager. Is there any license reason why I can't make my own jython distribution and expand it as a jar file? > Carlos Quiroz wrote: > > On Friday 07 September 2001 09:02, Finn Bock wrote: > > > [Carlos Quiroz] > > > > Hi > > > > Now everything is almost working but.... > > > > The installer has several System.exit(o) calls, that kill my embedded > > application :-( > > Well, one thing you can do is install a security manager that will ignore > the System.exit() calls (see below). You can get lots fancier, and check > the context of the call, etc., but this should prevent the exit from > occurring. Unfortunately, it will throw a SecurityException in the thread > that calls System.exit(). This is reasonable (you don't want the installer > thread processing any code after it tried to call exit, do you?), but it > means the code that calls the installer will have to handle the exception, > and that if something between your code and the call to System.exit() hides > the exception, you don't know what will happen. > > I know some servlet containers, etc., make System.exit() a no-op, but I'm > not sure how they manage that, and not sure you'd like that anyway: > > if beSafe: > System.exit(1) > doSomethingDangerous() > > :-) > > kb > > --- > from java.security import * > from java.lang import * > > class SM( SecurityManager ): > def __init__( self, delegate ): > self.allowExit = 0 > self.delegate = delegate > def checkExit( self, status ): > if self.allowExit: > SecurityManager.checkExit( self, status ) > else: > raise SecurityException( "Not allowed to exit at this time" ) > > def checkPermission( self, perm, context=None ): > if self.delegate: #allow anything if we don't have a delegate > if context: > self.delegate.checkPermission( self, perm ) > else: > self.delegate.checkPermission( self, perm, context ) > > sec = System.getSecurityManager() > sm = SM( sec ) > System.setSecurityManager( sm ) > try: > System.exit(0) > except: > print "not allowed to exit" > print "Did not exit" > > System.setSecurityManager( sec ) # replace original security manager, or > could just set allowExit print "Trying to exit again" > System.exit(0) > print "You won't see this" > > --- |
From: <bc...@wo...> - 2001-09-11 17:29:02
|
[Carlos Quiroz] >[...] >Is there any license reason why I can't make my own jython distribution and >expand it as a jar file? I have already answered Carlos in private, but to make is clear: all the licenses allow derivative works and redistributions. There are certain things that must be fullfilled first. The licenses files must be included, a list of mofications must be available somewhere and the result can not be called JPython. As always, common sense should be applied. regards, finn |