| View previous topic :: View next topic |
| Author |
Message |
web_dev Xandrosianling

Joined: 24 Jan 2006 Posts: 474 Location: Pennsylvania
|
Posted: Thu May 25, 2006 8:39 am Post subject: how to make .c or .java into .bin or .run? |
|
|
So, I have a few C and Java programs I have written in Xandros which I find myself using somewhat extensively, and I would like to put them into .runs or .bins ...can anyone tell me where to start? Which one do I choose and how do I do it? The programs are not gui based, but would it be possible to make some sort of file that you can just double click on and have them launch in console?
Basically I want to save myself the extra time of having to navigate to the program and do a ./ every time I want to run it. _________________ Welcome to the friendly XandrOS forums!
Registered Linux user #407955
 |
|
| Back to top |
|
 |
shengchieh Xandrosianschwing
Joined: 11 Jan 2004 Posts: 2382 Location: Palo Alto, CA
|
Posted: Thu May 25, 2006 10:31 am Post subject: |
|
|
*.c C program
*.jar java program
*.bin executable
For C, you need gcc. Open up XN, search for gcc, install C/C++
development libraries. Then on a console do
gcc ???.c
Look in manpage for options.
man gcc
You probably have java. Do
java -jar ???.jar
There is no manpage, but docs at
java -h
(help option)
bin files execute by itself. Do
./???.bin
You can write a shell script and put in .kde/Autostart (spelling?).
I.e.,
#!/bin/sh
java -jar ???.jar
gcc ???.c
./???.bin
Be sure to use the long pathname.
Sheng-Chieh _________________
 |
|
| Back to top |
|
 |
web_dev Xandrosianling

Joined: 24 Jan 2006 Posts: 474 Location: Pennsylvania
|
Posted: Fri May 26, 2006 8:22 am Post subject: |
|
|
ok, great thanks for the advice...
So just save the shell script as ???.bin right? _________________ Welcome to the friendly XandrOS forums!
Registered Linux user #407955
 |
|
| Back to top |
|
 |
bregma Xplorer
Joined: 29 Jan 2005 Posts: 82 Location: The back woods
|
Posted: Fri May 26, 2006 12:25 pm Post subject: Re: how to make .c or .java into .bin or .run? |
|
|
| web_dev wrote: |
Basically I want to save myself the extra time of having to navigate to the program and do a ./ every time I want to run it. |
It sounds like the problem is that your programs are not in your $PATH.
What I suggest you do is create a special place where you put all your executable files (files with the 'x' bit set in their permissions, -rwxr-xr-x) in a special place, say $HOME/bin, and then put that in your path by editing your $HOME/.bash_profile.
Java programs might need to be wrapped in a script to execute the JVM emulator program and feed it the class or jar file.
Alternatively, you could write shell functions or aliases to execute your programs using their absolute path name. For example, in my $HOME/.bash_profile I wrote a function to run the program vim with different options depending on where I am when I run it, just by typing the command vi.
| Code: |
# set PATH so it includes my home bin dir
if [ -d $HOME/bin ] ; then
PATH=$HOME/bin:"${PATH}"
fi
vi()
{
if [ -n "$DISPLAY" ]; then
/usr/bin/gvim "$*";
else
/usr/bin/vim "$*";
fi
}
export -f vi
|
I stuck this segment of code right at the end of my $HOME/.bash_profile file. |
|
| Back to top |
|
 |
web_dev Xandrosianling

Joined: 24 Jan 2006 Posts: 474 Location: Pennsylvania
|
Posted: Fri May 26, 2006 12:48 pm Post subject: |
|
|
Hmm, interesting fix bregma, I think I will try that as well...thanks!  _________________ Welcome to the friendly XandrOS forums!
Registered Linux user #407955
 |
|
| Back to top |
|
 |
|