0

I have a Java application that I am trying to launch from a JRuby script. I've been googling/t-shooting/iterating through so many solutions - my "basic" script is:

include Java
require 'c:/nm/bin/h4j.jar'
module HOLTER
  include_package 'com.nemon.h4j.H4JFrame';
end
include_class Java::ComNemonH4j::H4JFrame
H4JFrame.new

This throws the following error:

TypeError: no public constructors for Java::ComNemonH4j::H4JFrame
  (root) at h4j_initialTest.rb:7

And I've found that this also throws the same error:

$nm = HOLTER::H4JFrame.new

The main constructor for my application is:

public static void main(String argv[])
{
  captureOutput();
  new H4JFrame(argv);
}   

So what do I need to do to have my script simply launch my application? Any/all advice and pointers would be GREATLY appreciated!!

1 Answer 1

1

Does H4JFrame have a 0 argument constructor? In your java main you show it being called with String argv[] as the argument, so I would assume it does not. To start your application with your current code, you would need to pass a Java String array to H4JFrame.

include Java
require 'c:/nm/bin/h4j.jar'
module HOLTER
  include_package 'com.nemon.h4j.H4JFrame';
end
include_class Java::ComNemonH4j::H4JFrame
str_arr = ["example input", "this is an array of strings", "it is a ruby object"]
H4JFrame.new(str_arr.to_java :String)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.