Welcome to the most active Linux Forum on the web.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 03-04-2004, 09:57 PM   #1
Registered: Oct 2003
Location: Austin,TX
Distribution: Debian SID-->fully content-->Love APT,kernel 2.6.4
Posts: 327

Rep: Reputation: 30
run java programs from the command line...howto?

hi guys,
i have written a java program which is basically a port of the famous BSD games fortune.
Whenever i have to run the program i have to do:
java jfortune <filename>
now i was just wondering how i can run this like a normal program(you know the ones which are in /usr/bin) and have it run automatically without having to have the .class file in the same directory and without having to type java.
do you think writing a small shell script to do this would work?
thanks a lot.
Old 03-05-2004, 02:58 PM   #2
LQ Guru
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 46
In the command-line, you may always have to type 'java'. If you want to use the same program regularly, then you can make a script and put it in /usr/bin:

#contents of script
java jfortune <filename>

In a GUI, you can associate the class files with java
Old 03-06-2004, 01:33 AM   #3
Registered: Aug 2003
Location: Chennai, India
Distribution: PCLinuxOS .92, FC4
Posts: 840

Rep: Reputation: 31
Or you can use gcj to compile the program into executables

Then the'll run faster too
Old 03-06-2004, 02:50 AM   #4
Registered: Jul 2003
Location: Toronto, Canada
Distribution: Debian etch, Gentoo
Posts: 312

Rep: Reputation: 30
the hotspot JIT compiler has proven to be faster in cases than native executables, from what I have read... I can't back that up or explain it, but I'm certain I have seen that comment floating around in several places (IE news://



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Running Programs from command line sumguy231 Linux - Software 4 12-17-2004 03:10 PM
launching programs from command line in FS dertien Linux - Software 1 11-26-2004 09:27 AM
Howto run a java-applet in Mozilla? Schmurff Linux - Software 10 03-31-2004 02:40 PM
pppd from command line...howto Crasherz Linux - Networking 1 03-05-2004 10:52 AM
Launching Programs From the Command Line Chryzmo Linux - Software 5 03-03-2004 08:00 PM

All times are GMT -5. The time now is 11:28 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration