Starting a java jar from a Beanshell and vice versa
Submitted by Friday, 23 January, 2009 - 15:29
on
Hi
First, I'm new to all this java and beanshell stuff. Please be patient with me.
In general
* all beanshell files are stored on "C:\Program Files\jEdit\macros\xyMacros" and
* all jar files are stored on "C:\Program Files\jEdit\jars".
First problem:
==============
I want to extend jEdit with a beanshell macro, which calls xy.class in xy.jar file. The class in the class file is defined as "public class xy extends JDialog" and the main method is defined the following way:
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() ...
The jar file also contains other source files like icons and additional class files.
Now, the question is: how can I call the java code from the beanshell macro and what is needed to make it work (e.g. classpath, imports, ...)?
Second problem:
===============
Once the java code is executed and the dialog pops up I would like to execute a beanshell script, let's say myScript.bsh, when a certain button is pushed. The beanshell script then manipulates the textarea of the actual view in jEdit.
Questions here: How can I call beanshell scripts from the java code? Is there anything I need to do regarding the actual view, e.g. storing it in the java class and then give it to the beanshell script as an argument, or is this working right away?
If somebody could answer and give code examples, this would be great!
Thanks in advance!
First, I'm new to all this java and beanshell stuff. Please be patient with me.
In general
* all beanshell files are stored on "C:\Program Files\jEdit\macros\xyMacros" and
* all jar files are stored on "C:\Program Files\jEdit\jars".
First problem:
==============
I want to extend jEdit with a beanshell macro, which calls xy.class in xy.jar file. The class in the class file is defined as "public class xy extends JDialog" and the main method is defined the following way:
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() ...
The jar file also contains other source files like icons and additional class files.
Now, the question is: how can I call the java code from the beanshell macro and what is needed to make it work (e.g. classpath, imports, ...)?
Second problem:
===============
Once the java code is executed and the dialog pops up I would like to execute a beanshell script, let's say myScript.bsh, when a certain button is pushed. The beanshell script then manipulates the textarea of the actual view in jEdit.
Questions here: How can I call beanshell scripts from the java code? Is there anything I need to do regarding the actual view, e.g. storing it in the java class and then give it to the beanshell script as an argument, or is this working right away?
If somebody could answer and give code examples, this would be great!
Thanks in advance!