title: How to create distribution files(.exe) with jruby
body: <p>I have created a JRuby desktop application. Now I need to install on different platforms(Windows, Linux, Mac). Can any one help me on this</p>
  
  <p>Which is the painless method to create installation files OR executables with jruby. I googled and tried with RubyScript2exe, OCRA but none of these succeeded(really dont understood much). I am a noobie.. I really need it...</p>
  
  <p><strong>EDIT - TRYING A SIMPLE METHOD as jrubyc can create java equivalent class files(<a href="https://github.com/jruby/jruby/wiki/GeneratingJavaClasses" rel="nofollow noreferrer">described here</a>)</strong></p>
  
  <p>To start with packaging I created a HelloWorld.rb. Below is the file</p>
  
  <pre><code>require 'jruby/core_ext'
  
  swingClasses  = %w(JFrame JPanel JPopupMenu JMenuItem
                BorderFactory JLabel JTree JTextField Box JList 
                JComboBox ImageIcon BoxLayout JPasswordField
                JButton SwingConstants border.LineBorder 
                )
  swingClasses.each {|swc| java_import "javax.swing.#{swc}"}
  awtClasses    = %w(Color Dimension EventQueue event.ActionListener
      event.ActionEvent event.MouseAdapter)
  awtClasses.each {|awc| java_import "java.awt.#{awc}"}
  
  class HelloWorld &lt; JFrame
      def initialize
          super "welcome"
  
          main_panel = JPanel.new
          main_panel.setLayout BoxLayout.new main_panel, BoxLayout::Y_AXIS
  
          top_panel = JPanel.new
          top_panel.setLayout nil
          top_panel.setBackground Color.green   
          main_panel.add top_panel
  
          self.add main_panel
          self.pack
          self.setDefaultCloseOperation JFrame::EXIT_ON_CLOSE
          self.setSize 800,700
          self.setVisible true
      end
  end
  
  HelloWorld.new
  </code></pre>
  
  <p>The file is running fine with the command: <code>jruby HelloWorld.rb</code>. Also I have managed to created .jar file using: <code>jar cvfe HelloWorld.jar HelloWorld HelloWorld.class</code> with the .class file created using: <code>jrubyc HelloWorld.rb</code></p>
  
  <p>But when I run the jar using: <code>java -jar HelloWorld.jar</code>, I am getting the below error.</p>
  
  <pre><code>Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.NoClassDefFoundError: org/jruby/ParseResult
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
    at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
    at java.lang.Class.getMethod0(Class.java:3018)
    at java.lang.Class.getMethod(Class.java:1784)
    at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
    at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  Caused by: java.lang.ClassNotFoundException: org.jruby.ParseResult
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 7 more
  </code></pre>
  
  <p>Please throw me some lights on how to solve this... </p>
  
  <p><strong>EDIT</strong>
  This found to be becouse of the lack of additional files OR classfiles. Didn't find any file/jar named org.jruby.ParseResult in jruby installed. How we can know what all files need to be added for an application as I am not using any particular libraries. I am expecting it to run if JRE installed. Please guide me. Can some one share me what I can do here</p>