Reputation: 29
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!!
Upvotes: 0
Views: 176
Reputation: 36
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)
Upvotes: 1