LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
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.

Notices


Reply
  Search this Thread
Old 10-17-2006, 03:19 PM   #1
radar5000
LQ Newbie
 
Registered: May 2006
Posts: 2

Rep: Reputation: 0
How do you make programs in linux?


I am just getting into linux and I want to start programing and making programs. I know how to program in java but I want to make programs that I can install on other computers and use without having to install a compiler or anything on that. Basically what I want to do is like a .exe in windows but for linux. Im trying to understand linux and im having a tough time with . Can someone please HELP ME!!!!!!!!!!!
 
Old 10-17-2006, 03:30 PM   #2
Youri
Member
 
Registered: Oct 2004
Distribution: slamd64-current, slackware-current, clfs 6.1, arch-current, ubuntu dapper
Posts: 144

Rep: Reputation: 15
quick ref for making and running a java prog:

Code:
vim main.java
or any favorite editor ya got

create the code in java

exit the editor (after saving it ofcourse)

compile it
Code:
javac main.java
(now here is the triky part in linux it depends on your distro if its in there or not ya can always install your distro specific sdk)

run it
Code:
java main

Last edited by Youri; 10-17-2006 at 03:32 PM.
 
Old 10-17-2006, 03:45 PM   #3
St.Jimmy
Member
 
Registered: Jun 2006
Location: Boaz,Alabama
Distribution: Ubuntu 10.10 / Windows 7 Pro 64-Bit / Snow Leopard 10.6.4 64-Bit
Posts: 152

Rep: Reputation: 30
some langs allow you just to chmod the source and make it executable, I think java can too. If not,your ide (i reccomend eclipse) should have settings to make a package to be installed.
 
Old 10-17-2006, 04:20 PM   #4
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
I use izpack on linux and nullsoft on Windows. You can also create rpm , deb and tgz packages but it is not easy...
 
Old 10-17-2006, 04:34 PM   #5
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Hi, radar5000 -

There are different kinds of "executables" on Linux, just like there are under Windows. If you want to make a binary ".exe" under Windows, you'd need a "compiler". Visual Studio popular under Windows. Similarly, you'd need a compiler under Linux. "Gcc" is a popular choice for Linux C/C++ compiler.

Windows recognizes ".exe" files by their suffix (.exe). Linux, on the other hand, recognizes a file as "executable" by its *file permissions*. Even if you had a valid Linux ".exe", you'd need to set its permissions, using the command "chmod +rx MYFILE" (where "MYFILE" is the name of your program). You generally don't have to worry about "chmod": the GCC compiler takes care of this automatically for you.

Here's a somewhat dated - but still useful - tutorial on GCC:
http://www.bigwebmaster.com/General/Howtos/GCC-HOWTO/

Another kind of executable is an "interpreted script". Windows has ".bat" files. It also has .cmd, .vbs, and lots of other "script" formats. The Linux equivalent of a .bat file is a "shell script". Again: you don't need any special suffix, but you *do* need to "chmod +rx FILENAME", and it does need to be written in a special language. The default shell in Linux is "bash":

Here's a tutorial on bash:
http://www.hypexr.org/bash_tutorial.php

Finally, you can run a Java program on Linux just as you can on Windows - all you need to do is install the Java runtime someplace.

'Hope that helps .. PSM
 
Old 10-18-2006, 09:47 AM   #6
mrcheeks
Senior Member
 
Registered: Mar 2004
Location: far enough
Distribution: OS X 10.6.7
Posts: 1,690

Rep: Reputation: 52
You can use forehead or classworld to launch jars from command line. See syntax for desktop files and bash scripts.
 
Old 10-18-2006, 12:42 PM   #7
lordSaurontheGreat
Member
 
Registered: Sep 2006
Distribution: Gentoo, SuSE 10
Posts: 94

Rep: Reputation: 16
Quick and Dirty overview:

(as root) $ chmod 755 <file>
makes a file executable. BE CAREFUL!!! ANY file can be made executable, and WILL be loaded into the CPU even if it's not supposed to be!

gcc <file>
compiles a C source file

g++ <file>
compiles a C++ source file

for more info on all of these, read the man pages. Type man <command> into your terminal to read the manpages.

CAUTION: the manpages for gcc and g++ are ultra-long. Gloss over them, or read my tutorial at http://lordsauronthegreat.googlepage...e-fileprograms

I only know how to do single-file programs right now, but I'm learning how to do it with multiple files (slowly... but surely).

HTH.
 
Old 10-18-2006, 02:56 PM   #8
xhi
Senior Member
 
Registered: Mar 2005
Location: USA::Pennsylvania
Distribution: Slackware
Posts: 1,065

Rep: Reputation: 45
http://www.gnu.org/manual/manual.html

check out gcc and make first..
 
Old 10-18-2006, 11:39 PM   #9
radar5000
LQ Newbie
 
Registered: May 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Thanks for all of the suggestions. They will help. If any body has something else to add please do.
Thanks
 
  


Reply



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
Help with installing programs with ./configure and make WiteDuv7 Linux - Newbie 1 04-14-2006 02:25 PM
how to make gtk programs kira Programming 1 04-28-2005 07:34 AM
How do you make C++ programs smaller? Qwirt Programming 5 11-04-2004 11:32 PM
Want to make a website...what programs should I use? arctic123 Linux - Software 13 09-12-2004 09:54 PM
C++ and OpenGL- how to make programs/games compatible with both windows and linux uveraser Programming 9 06-16-2004 02:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 10:02 AM.

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