Jsh, the doc

What is Jsh | How to run a java webstart application ? | How to install a new application ? | How to run a batch script ? | How to change the classpath | How to define an alias ? | Back to home page | Screenshots

visitors since 11 / 09 / 2000 Development hosted at Sourceforge Original Jsh website from osvaldo

 

What is Jsh ?

 

Jsh is basically a java shell, or a java launcher. That is, a program with a prompt that allows you to type sequence of commands. For example, with Jsh, you can start a java program simply by typing it's main class.

As jsh becomes more sophisticated, it will end up being a full application manager, with a graphical user interface, application installation / desinstllation, better OS integration, etc...

The aim is to allow ordinary computer users, as well as experts, to use applications in Java in their daily life. Sounds good eh ?

Jsh is an opensource project. You can download source code, modify it, do whatever you want with it. Simply send us a message !

How to run a jnlp (java webstart) application ?

 

By using tal liron's java_url, Jsh can propose an almost complete jnlp implementation. It supports FileServices, data cache, fine grained security, and of course all your java web applications runs in the same jvm !

An alias has been defined for this purpose :

Type :

c:\java:jsh> jnlp -gui &

this will display a window allowing you to choose the application you want to run, or if you now the url,

c:\java:jsh> jnlp http://myServer/myApp.jnlp

will run it directly.

Application datas are cached automatically in {user.home}/.java_url/cache. The next time you reload it, it will use the cache.

 

 

 

How to install a new application ?

 

Install your java application normally. Look in its installation directory : You should see some .jar, .zip or .class files.These files or directories must be included in the classpath of your application.

To run it under jsh, simply write a jsh script that will go to the installation directory; set the classpath for the application and run it. For example, once jext is installed, it can be run with :

C:\Java:jsh> cd c:\apps\jext; set classpath = c:\apps\jext\jext.jar ; com.chez.powerteam.jext.Jext

write this down to a .jsh file, copy the file to the jsh install directory, and now run the script using :

C:\Java:jsh> jsh jext.jsh &

// The & means it will be run in the background

You can define an alias for the applications you run often.

 

 

How to run a batch script ?

 

Script files ends with jsh extensions. You can write a script file by writing all commands separated by a ';'.

These file can be run in two different ways :

  • Directly when starting jsh by giving the jsh filename as a parameter. For exemple, under Windows type jsh.bat FileToRun.jsh
  • Under jsh prompt, type jsh FileToRun.jsh to run it.

You can also call scripts using arguments: jsh jext.jsh fileToEdit.txt. Each argument will be accessible from the script using $1, $2...

For example, if you call the script containing
set classpath = c:\apps\jext\jext.jar ; com.chez.powerteam.jext.Jext $1
using
C:\Java:jsh> jsh jext.jsh FileToEdit.txt
, then the $1 will be replaced by 'FileToEdit.txt' when the script is run.

How to change the classpath ?

 

The classpath you use for running jsh is the system classpath and cannot be changed.

But each application can have his own classpath, that will be added to the system classpath. Classes loaded from this classpath are completely independant of each others. That means, two java applications can run two different classes with the same name. It's usefull when these two applications uses the same class but not in the same release.

To define a classpath for an application, simply set the classpath to the desired value before running the application. For example,

/home/java:jsh>set classpath = /usr/lib/app_classesv11.jar ; org.jedit.Main &

will run class org.jedit.Main using classes in app_classesv11.jar

You can declare more than one jar or directory in the classpath. Use the path separator char your used to in your system (like for system classpath)

Under unix, you can write :

/home/java:jsh>set classpath = /usr/lib/app_classesv11.jar:/usr/lib/componentx:/usr/lib/test.zip

Under NT, it's a little bit different, as ';' is used as a path separator and a instruction separator in jsh. You should add the escape char '\' before ';' in the classpath :

C:\Java:jsh>set classpath = c:\java\lib\app_classesv11.jar\;c:\java\lib\componentx\;c:\java\lib\test.zip

Notice the "\;" as a separator.

How to define an alias ?

 

An alias is a kind of shortcut.Instead of typing each time a whole bunch of commands, you write it once as an alias, and then rerun it simply by typing the name of alias.

To define an alias, edit the file jsh.properties in your home directory (win95-98 users should find it in windows directory), and simply type alias.name = instruction.

For example :

alias.escape = jsh escape2.jsh

will run the escape2.jsh script file each time you type escape in the jsh prompt.

How to use environment variables ?

 

Just like Linux, Jsh allows you to define environment variables using the set command.

To define a variable, type :

/home/java:jsh>set variable=value

To use it, write it inbetween $'s :

/home/java:jsh>set variable2=$variable$

/home/java:jsh>ClassToRun $variable$/File.html

Toubleshooting

 

My favorite application doesn't work, I've got an Class Not Found error !

- First, check you've typed the application classpath correctly in your .jsh batch file

- Second, check if the jar file containing the class not found is defined in your application classpath. Some applications, like jBuilder, loads their classes dynamically. Simply add all dynamically loaded jars in the application classpath before running it.

- If that doesn't work, put the jar files of your application in the jvm classpath (the classpath used for running jsh, defined in jsh.sh or jsh.bat).

- If it's still not good, well, you can say your application doesn't work with Jsh. Send us a message telling where we can download it so that we can see what we can do...

 

 

 


(c) 1999-2002 COLLIN Gérard
View Appliweb Internet Engine : Homepage | Description | Technology | Download
Development | Documentation | News