Solved

Java unix executable

Posted on 2000-03-15
4
327 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
ID: 2622188
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
ID: 2622295
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
ID: 2623267
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
ID: 2678009
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

863 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

18 Experts available now in Live!

Get 1:1 Help Now