Solved

Java unix executable

Posted on 2000-03-15
4
331 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

729 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