def run_local(argument=@argument, main_class='net.sf.sail.emf.launch.EMFLauncher2')
      if RUBY_PLATFORM =~ /java/
        
        java.lang.Thread.currentThread.setContextClassLoader(JRuby.runtime.jruby_class_loader)
        
        require_resources
        configUrl = URL.new(JavaIO::File.new("dummy.txt").toURL, argument) 
        # configUrl = URL.new("document-edit.config")  
        unless @bundleManager
          @bundleManager = SailCoreBundle::BundleManager.new
          @serviceContext = @bundleManager.getServiceContext
          @bundleManager.setContextURL(configUrl)
          # 
          # Add the <code>bundles</code> configured in this bundles xml file. The format of the file
          # is XMLEncoder
          # 
          @bundleManager.addBundles(configUrl.openStream)
          # 
          # Have all the bundles register their services, and then do any linking
          # to other registered services
          # 
          @bundleManager.initializeBundles
          # 
          # Start the session manager
          # 
          @manager = @serviceContext.getService(SailCoreService::SessionManager.java_class)
        end
        @manager.start(@serviceContext)
      else
        command = "java -classpath #{local_classpath} #{main_class} '#{argument}'"
        $pid = fork { exec command }
      end
    end
def run_local(argument=@argument, main_class='net.sf.sail.emf.launch.EMFLauncher2')
      if RUBY_PLATFORM =~ /java/
        
        java.lang.Thread.currentThread.setContextClassLoader(JRuby.runtime.jruby_class_loader)
        
        require_resources
        configUrl = URL.new(JavaIO::File.new("dummy.txt").toURL, argument) 
        # configUrl = URL.new("document-edit.config")  
        unless @bundleManager
          @bundleManager = SailCoreBundle::BundleManager.new
          @serviceContext = @bundleManager.getServiceContext
          @bundleManager.setContextURL(configUrl)
          # 
          # Add the <code>bundles</code> configured in this bundles xml file. The format of the file
          # is XMLEncoder
          # 
          @bundleManager.addBundles(configUrl.openStream)
          # 
          # Have all the bundles register their services, and then do any linking
          # to other registered services
          # 
          @bundleManager.initializeBundles
          # 
          # Start the session manager
          # 
          @manager = @serviceContext.getService(SailCoreService::SessionManager.java_class)
        end
        @manager.start(@serviceContext)
      else
        command = "java -classpath #{local_classpath} #{main_class} '#{argument}'"
        $pid = fork { exec command }
      end
    end
def run_local ( argument = @argument , main_class = 'net.sf.sail.emf.launch.EMFLauncher2' ) if RUBY_PLATFORM =~ / / java . lang . Thread . currentThread . setContextClassLoader ( JRuby . runtime . jruby_class_loader ) require_resources configUrl = URL . new ( JavaIO :: File . new ( "dummy.txt" ) . toURL , argument ) # configUrl = URL.new("document-edit.config")   unless @bundleManager @bundleManager = SailCoreBundle :: BundleManager . new @serviceContext = @bundleManager . getServiceContext @bundleManager . setContextURL ( configUrl ) #  # Add the <code>bundles</code> configured in this bundles xml file. The format of the file # is XMLEncoder #  @bundleManager . addBundles ( configUrl . openStream ) #  # Have all the bundles register their services, and then do any linking # to other registered services #  @bundleManager . initializeBundles #  # Start the session manager #  @manager = @serviceContext . getService ( SailCoreService :: SessionManager . java_class ) end @manager . start ( @serviceContext ) else command = "java -classpath #{local_classpath} #{main_class} '#{argument}'" $pid = fork { exec command } end end
This will start the jnlp locally in Java without
 using Java Web Start

 This method works in MRI by forking and using exec
 to start a separate javavm process.


 JRuby Note:

 In JRuby the jars are required which makes them available
 to JRuby -- but to make this work you will need to also
 included them on the CLASSPATH.

 The convienence method Jnlp#write_local_classpath_shell_script
 can be used to create a shell script to set the classpath.

 If you are using the JRuby interactive console you will need to
 exclude any reference to a separate jruby included in the jnlp.

 Example in JRuby jirb:

   j = Jnlp::Otrunk.new('http://rails.dev.concord.org/sds/2/offering/144/jnlp/540/view?sailotrunk.otmlurl=http://continuum.concord.org/otrunk/examples/BasicExamples/document-edit.otml&sailotrunk.hidetree=false', 'cache'); nil
   j.write_local_classpath_shell_script('document-edit_classpath.sh', :remove_jruby => true)

 Now exit jirb and execute this in the shell:

   source document-edit_classpath.sh

 Now restart jirb:

   j = Jnlp::Otrunk.new('http://rails.dev.concord.org/sds/2/offering/144/jnlp/540/view?sailotrunk.otmlurl=http://continuum.concord.org/otrunk/examples/BasicExamples/document-edit.otml&sailotrunk.hidetree=false', 'cache'); nil
   j.run_local

 You can optionally pass in jnlp and main-class arguments
 If these paramaters are not present Otrunk#run_local will
 use:

   net.sf.sail.emf.launch.EMFLauncher2

 as the default main class and the default argument in
 the original jnlp.
This will start the jnlp locally in Java without using Java Web Start