Skip to content

kumarvv/ijc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ijc

Interactive Java Console which enables to quickly run/verify java statements without the need of .java files, compiling using javac and running using java.

This tool is written in bash script with simplicity in logic and usage.

Installation

Checkout ijc.sh file and add it to your path. This tool is verified in Mac bash shell only at this time, but should run in any bash supported shell.

Usage

Run following command in Mac terminal:

$ sh ijc.sh 
ijc (Interactive Java Console) v0.1
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)

ijc> 

Try System.out.println:

ijc> System.out.println("Hello World!")
Hello World!
ijc> 

Use `` to start and end multi-line statements:

ijc> ``
int times = 5; 
for (int i = 0; i < times; i++) { 
  System.out.println(i + ": Hello"); 
} 
``
0: Hello
1: Hello
2: Hello
3: Hello
4: Hello
ijc> 

Use arrow keys to move cursor left or right and also to see last used statements (history).

This tool caches the statements and appends to current runtime. For an example:

ijc> String name = "Hello"; 
ijc> name += " World"; 
ijc> int times = 3; 
ijc> for (int i = 0; i < times; i++) { System.out.println(name); } 
Hello World
Hello World
Hello World
ijc> 

Imports:

This tool currently imports following packages by default:

java.util.*; 
java.io.*; 
java.math.*; 

Additional packages or classes can be added using import statements:

ijc> import java.lang.reflect.Method;
ijc>

Imported classes will be available current runtime context.

Commands

Type help to get list of commands available:

ijc> help 
ijc help

Type java statements in ijc>  prompt and press ENTER to execute. Multiple statements can be entered by enclosing with 

help          - ijc help
show          - displays current statements from cache
reset         - resets statements cache
import <s>    - adds import statements to cache
cp | classpath <s>[:<s>...]
              - adds classpath to current cache, these will be added to classpath when running statements
print [s]     - shortcut for java System.out.println()
``            - start or end multi-line statements
exit | quit   - exit ijc

About

Interactive Java Console (run java statements interactively without using javac/java)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages