How should a Jabaco app be written, such that it's procedures are callable from Java or Groovy or Jabaco or any jvm-based application?
??? If you set your SUBs and FUNCTIONs to PUBLIC and not to PRIVATE, they are automatically accessable from every JVM-language.
In other words, I want to create a number of subroutines, in a Jabaco app - STATIC routines which don't require object instantiation - generate the jar, and then use those subroutines from Java.
That is possible. Where is the problem, to do so?
How does such a callable Jabaco app get written, so that its subroutines are visible elsewhere?
As I have said, you have set them to PUBLIC.
The parent Java/Groovy/Clojure/Jabaco part I understand; but am not clear about the format of the code in the callable Jabaco project.
I really don't see the problem, to do so.
For example:
Create a "new Project" and select "Class Library" as new project type.
As default, there is now the only class
Class1.
Remove this text:
|
Jabaco Source
|
1
2
3
4
|
Private Sub Class_Initialize()
' [Your Source] ...
End Sub
|
and write instead:
|
Jabaco Source
|
1
2
3
|
Public Static Sub SayHello()
MsgBox "Hello Jabaco-folks!"
End Sub
|
In the properties set as Namespace for example "myNameSpace".
So that the folloing properties exists:
|
Source code
|
1
2
3
4
5
|
(Access): Public
(Name): Class1
(NameSpace): myNameSpace
(SuperClass): java/lang/Object
(Type): Class
|
Thats it. Now compile it:
Click in the menu "File" -> "Make Project..."
Select as Filetype "Jar-File". And use as FileName for example "MyClass.jar". Save that file on any location you want.
Now access it from Java.
Go in that directory, in which you have saved MyClass.jar and create (for example with notepad.exe) there the file "JavaTest.java", which have the following code:
|
Source code
|
1
2
3
4
5
6
7
|
import myNameSpace.*;
public class JavaTest {
public static void main(String[] args) {
Class1.SayHello();
}
}
|
I assume, that you have installed the JDK on your computer.
So, then write in the commandline
|
Source code
|
1
|
javac.exe -cp MyClass.jar;. JavaTest.java
|
Now you can start it with
|
Source code
|
1
|
java.exe -cp MyClass.jar;. JavaTest
|
Then there opend a dialog-window,m in which stands "Hello Jabaco-folks". Thats the thing, you have written in Jabaco.
Greatings
theuserbl