Jarminal is to Java what the python shell is to Python
Now jarminal is a linux tool. I will only just post the man page here. Any linux person should be able to read the man page and understand what it does.
jarminal(1) Jarminal jarminal(1)
NAME
jarminal – a java interactive shell
SYNOPSIS
jarminal [option] [command]
LICENSE
GNU General Public License
DESCRIPTION
jarminal is a java interactive shell.
Jarminal emulates the python shell and provides a means of executing
java commands interactively.
The normal procedure to executing the smallest java code is
· create the java file
· compile the java file
· execute the java class created from step 2 above
This might not be effective if all you want to do is test if a small
code snippet will work or not.
This shortcoming has been the strenght of languages like python where
you can test some code snippets
before you finally include them in your project.
Jarminal makes this interactive shell functionality available to java
programmers too.
OPTIONS
-e | –execute escapedstring You can use this option to execute a java
code without starting the interactive terminal
SAMPLE jarminal -i “System.out.println(\”Hello World\”);”
NOTE that the Hello World is escaped, and the final semi-colon
is inside the string
-i | –interactive This command will start the interactive terminal.
In this mode, you dont have to escape strings
Classes can be defined and they are available throughout the
interactive session
class declaration can span multiple lines
You can import java packages and they are available throughout
the session
Except for the above, previous commands dont have any effect on
the new command
To execute a block of code (normally across multiple lines) use
a open and close brace { }
Control Structures can span multiple lines
SAMPLE
jarminal>> System.out.println(“Hello World”);
Hello World
jarminal>> public class One {
public void writeSomething(String something) {
System.out.println(something);
}
}
jarminal>> new One().writeSomething(“jarminal is sooooooo
cool”);
jarminal is sooooooo cool
jarminal>> for(int i=0; i<5; i++) {
new One().writeSomething(String.valueOf(i));
}
1
2
3
4
5
jarminal>> import javax.swing.*;
jarminal>> JOptionPane.showMessageDialog(null, “jarminal on
steroids”);
jarminal>>exit
-h | –help [fqcn]
Displays a minimal description of how to use jarminal if fqcn is
not supplied
fqcn – Fully Qualified Class Name.
If a fully qualified class name is provided e.g
java.util.Hashtable jarminal displays a javadoc help page.
But for this to work, you have to configure the java doc path in
the config file /etc/jarminal.conf
The javadoc help functionality can also be invoked from the
interactive shell.
SAMPLE jarminal>> help java.awt.Dimension
FILES
/etc/jarminal.conf
0.1 02 February 2008 jarminal(1)
The source code is available on github.
www.github.com/segun/jarminal
EDIT: moved to gitorious http://gitorious.org/jarminal
you can get the rpm too there.
My next work is to make it a netbeans plugin. If anyone could take this up however, I will be more than happy.
Erik G said
Pardon my ignorance, but how is this different from BeanShell (JSR-274)?
Akintayo Olusegun said
The truth is I have never heard of BeanShell till now. In fact if I had known of BeanShell I wouldn’t have gone ahead to do all that work. But its good anyway, some times we all have to come out of some kind of shell. lol
Thanks for the post. At least I can say one useful and important thing that blogging has done for me is make me know about beanshell. lol
Akintayo Olusegun said
I have just looked at beanshell, its quite different from what I have in mind with jarminal. I think you should download jarminal, use it and compare it to beanshell. You will see that they behave differently. Someone just told me about MVEL and I am checking it out too. Thanks anyway
Alan McKean said
I will be looking at Jarminal but I wanted to alert you to the Scala shell. You can get it at http://www.scala-lang.org. I have been using it as a Java scripting tool for over a year now and I like it a lot.
Akintayo Olusegun said
Thank, I use scala too, And I used the shell. Jarminal was concieved before I started using scala.
Akintayo Olusegun said
and I have looked at MVEL too. It does some and not all of the things I want. I think I will just join the MVEL development team.