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 |
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.
|
gcc is gnu C compiler, it compiles C, not java. You need to go here and get the SDK (software development kit)
|
thx darin3200, i did that and it works fine now.
|
I want too share two files between two machines. Im runnig Fedora. Plese instruct me how to do so.
|
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! |
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.. |
Quote:
|
All times are GMT -5. The time now is 04:35 AM. |