Solved

Java unix executable

Posted on 2000-03-15
4
326 Views
Last Modified: 2008-02-01
Hi
I have created a series of java applications, that reside in my account
on a Solaris box. The problem is that, other people would like to
use these applications as well. Now is there a way to create an executable for them such that
instead of the users (who have no java experience) having
to
$java foo.class
simply copy an executable across
ie to run the program
$foo

Any help would be appreciated
Thanks

0
Comment
Question by:virtuala
4 Comments
 
LVL 4

Expert Comment

by:pluim
Comment Utility
Are the other users on the same machine? If so, just create a shellscript that invokes the program:

#!/bin/ksh
# This will run foo.class
CLASSPATH=$CLASSPATH:/<path_to_foo>
java foo.class

Put the script in a directory which is in the user's path (e.g. /usr/local/bin), or have them copy it to their working directory.

If it has to be on a different machine... that's more tricky. If they are familiar with tar (unlikely), write a shellscript similar to the one above and distribute it with the class file, all in one tar file.

I think you're making life very difficult for yourself though. If a user can type 'foo', they can certainly type 'java foo.class'. Documentation is a wonderful thing, you can't solve everything by code (although I've tried!).

pluim.



0
 

Expert Comment

by:ganeshtnr
Comment Utility
Hi !
 You can very well write a shell Script for that.  I am typing out a sample.  Just check whether it meets your requirement.
-----cut here----
!#/bin/sh
echo " About to Run $1 class file..."
java $1
-----cut here----
Usage:  if the name of this is say foo, then
$ foo Ganesh
will run the Ganesh class.  Hope this helps!!

Don't forget to do "chmod 700 foo".

Bye
Ganesh
0
 
LVL 8

Expert Comment

by:diakov
Comment Utility
you can also make an applet and put it on your web page. this way everybpdy can enjoy it.

Nik
0
 
LVL 2

Accepted Solution

by:
azawawi earned 50 total points
Comment Utility
if you want executables, use The GNU Compiler for the Java  Programming Language found @ http://sourceware.cygnus.com/java/

also it will be faster if performance is an issue...




0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now