LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 04-17-2004, 04:21 PM   #1
jmax24
Member
 
Registered: Apr 2004
Posts: 39

Rep: Reputation: 15
How to compile and run a java program in linux !!!!


I have just started programming java using my linux machine. I am running redhat 8 and am wondering if there is anything special i have to get in order to compile and run my jave programs. I was under the impression i could use gcc, so i tried gcc Hello.java and all i got was errors. Any help here would be greatly appreciated.

thx,

jmax24
 
Old 04-17-2004, 04:26 PM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
it's not gcc that you want to use. try the gcj3 command. i think that's the one you want, but i don't use it so i don't know.
 
Old 04-17-2004, 04:28 PM   #3
darin3200
LQ Guru
 
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
gcc is gnu C compiler, it compiles C, not java. You need to go here and get the SDK (software development kit)
 
Old 04-17-2004, 05:28 PM   #4
jmax24
Member
 
Registered: Apr 2004
Posts: 39

Original Poster
Rep: Reputation: 15
thx darin3200, i did that and it works fine now.
 
Old 03-20-2006, 12:09 AM   #5
prkherath
LQ Newbie
 
Registered: Jan 2006
Posts: 1

Rep: Reputation: 0
I want too share two files between two machines. Im runnig Fedora. Plese instruct me how to do so.
 
Old 03-20-2006, 01:22 AM   #6
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
For whatever it's worth, I'd consider loading Sun's Java Development Kit (JDK):
http://java.sun.com

If you prefer gjc, great. If you're new enough that don't know the difference between Sun Java and gjc - then you're really better off learning Java from the Sun JDK.

IMHO ...

PS:
And if you followed darin3200's advice and got Netbeans ... then please spend at least a little time outside of the IDE, familiarizing yourself with the "javac", "javadoc" and "java" command lines. You'll be much happier - and much more productive in the IDE - as a consequence! Honest!

Last edited by paulsm4; 03-20-2006 at 01:25 AM.
 
Old 08-06-2010, 03:45 AM   #7
aher.praju@yahoo.com
LQ Newbie
 
Registered: Jun 2010
Location: India
Posts: 2
Blog Entries: 4

Rep: Reputation: 0
Smile

Hello,

As Java having its own slogan “Create once and run everywhere” , means its totally platform independent so jst adding the JVM(Java Virtual Machine) on Linux, you can execute the java applications on linux.

As I consider you already installed the jdk on your linux server in the directory /usr/local/jdk

Lets test.java be our java application and be sure, now pwd having the /usr/local/jdk path

Now start the execution:

root@localhost:/usr/local/jdk#javac test.java

By javac ,compilation of your application be done and class file of name test.class be created(test.class is in the byte code format)

root@localhost:/usr/local/jdk#java test

And here is the execution of your application,now you can see the output of your application.

**For More details Please refer http://topukhosting.co.uk/Brew-your-...ation-on-Linux..

Last edited by aher.praju@yahoo.com; 08-06-2010 at 03:56 AM.
 
Old 08-06-2010, 03:56 AM   #8
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by prkherath View Post
I want too share two files between two machines. Im runnig Fedora. Plese instruct me how to do so.
What does it have to do with the thread ?
 
  


Reply

Tags
java, linux



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
how to run linux command from java program? ranger225 Linux - Newbie 1 11-10-2004 06:55 AM
compile and run java pelegk2 Programming 3 10-05-2004 09:28 AM
GIF gone in program when compile Java in Linux dwarf007 Programming 1 09-30-2004 11:15 PM
How to compile and run my first program vanhelsing Programming 2 07-11-2004 02:41 PM
Compile and run java in Linux Redhat medeluckiest Linux - Newbie 1 03-15-2004 09:03 AM

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

All times are GMT -5. The time now is 02:27 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