forums.xandros.com Forum Index forums.xandros.com
Xandros User Forums
 
 FAQFAQ   SearchSearch   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to make .c or .java into .bin or .run?

 
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Linux Devel 101
View previous topic :: View next topic  
Author Message
web_dev
Xandrosianling
Xandrosianling


Joined: 24 Jan 2006
Posts: 474
Location: Pennsylvania

PostPosted: Thu May 25, 2006 8:39 am    Post subject: how to make .c or .java into .bin or .run? Reply with quote

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
View user's profile Send private message
shengchieh
Xandrosianschwing


Joined: 11 Jan 2004
Posts: 2382
Location: Palo Alto, CA

PostPosted: Thu May 25, 2006 10:31 am    Post subject: Reply with quote

*.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
View user's profile Send private message Visit poster's website
web_dev
Xandrosianling
Xandrosianling


Joined: 24 Jan 2006
Posts: 474
Location: Pennsylvania

PostPosted: Fri May 26, 2006 8:22 am    Post subject: Reply with quote

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
View user's profile Send private message
bregma
Xplorer


Joined: 29 Jan 2005
Posts: 82
Location: The back woods

PostPosted: Fri May 26, 2006 12:25 pm    Post subject: Re: how to make .c or .java into .bin or .run? Reply with quote

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
View user's profile Send private message
web_dev
Xandrosianling
Xandrosianling


Joined: 24 Jan 2006
Posts: 474
Location: Pennsylvania

PostPosted: Fri May 26, 2006 12:48 pm    Post subject: Reply with quote

Hmm, interesting fix bregma, I think I will try that as well...thanks! Very Happy
_________________
Welcome to the friendly XandrOS forums!
Registered Linux user #407955
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.xandros.com Forum Index -> Linux Devel 101 All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group