Results 1 to 10 of 10
Hi, I'm using a webhosting server running CentOS, and I'm trying to install GCC to compile Java on the server. Since I'm new to Linux and don't have root privileges, ...
- 02-21-2011 #1Just Joined!
- Join Date
- Feb 2011
- Posts
- 5
Need help installing GCC
Hi, I'm using a webhosting server running CentOS, and I'm trying to install GCC to compile Java on the server. Since I'm new to Linux and don't have root privileges, I'm having trouble installing this. I need to install this using command-line. I don't know if I should compile from source (which I downloaded off the "gcc.gnu.org" website) or if I need to install a binary or something. Can I even install anything without root privileges? I'm at a loss for what to do, so any help would be appreciated. Thanks for your help!
- 02-22-2011 #2
You'll need root or "sudo" privileges at some point. You should be able to install gcc using yum.
Glenn
Powered by Fedora 16 and Arch Linux
- 02-24-2011 #3Just Joined!
- Join Date
- Feb 2011
- Posts
- 5
Okay, I wasn't sure because I had downloaded the Java JDK and was able to run the javac program. The problem i had was that the server didn't have enough memory to run Java (which is why I'm trying to use GCC). I was still able to start it though without root privileges. I was hoping the same sort of thing could be done with GCC. Is there any way to run GCC without installing it (like an executable file on Windows)?
- 02-26-2011 #4Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
You can install the compiler and its libraries in your own home directory tree without root permissions, I think - haven't tried this before. You will likely need to specify the --prefix=~/your-install-directory to configure so when you execute "make install" it will copy stuff to ~/your-install-directory. The executables will go into ~/your-install-directory/bin and libraries into ~/your-install-directory/lib (or lib64), etc. Then you will need to adjust your PATH and LD_LIBRARY_PATH environment variables so the compiler and shared libraries will be found first in ~/your-install-directory/...
So, clear as mud yet?
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-15-2011 #5Just Joined!
- Join Date
- Feb 2011
- Posts
- 5
Sorry for taking so long to reply. I've been trying to get this working, but I don't think I'll be able to with my limited knowledge of linux. Anyways, I appreciate your help.
- 03-15-2011 #6
you don't compile java with gcc, that is a C compiler
you need to use java jdk to run and compile java applications
you may be able to use gcj, though i'm not sure how well it works
- 03-15-2011 #7
- 03-15-2011 #8Just Joined!
- Join Date
- Feb 2011
- Posts
- 5
I thought gcc stands for "GNU Compiler Collection". Doesn't it include gcj? It's not only for c and c++. That's what it sounds like from this website:gcc.gnu.org.
From the gcc site: "GCJ is a portable, optimizing, ahead-of-time compiler for the Java Programming Language. It can compile Java source code to Java bytecode (class files) or directly to native machine code, and Java bytecode to native machine code."
From what I read elsewhere on the internet, it sounds like many people use it.
- 03-15-2011 #9Linux Guru
- Join Date
- Apr 2009
- Location
- I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
- Posts
- 8,974
For true java portability, you should use the java compiler from sun/oracle. The gnu gcj is great for taking java applications and turning them into machine code, either from source or compiled bytecode. However, there are incompatibilities that can cause differences in application behavior, so additional testing would be required. In any case, I would opt for the "standard" java compiler if I am going to compile to java byte code, and gcj if I want to compile java byte code to more efficient machine code.
Sometimes, real fast is almost as good as real time.
Just remember, Semper Gumbi - always be flexible!
- 03-18-2011 #10Just Joined!
- Join Date
- Feb 2011
- Posts
- 5
Alright, I didn't know that sun's java compiler would be much different. So it looks like sun's compiler is better for what I want to do. Everything's good now (except that my hosting provider wants me to pay extra for java support). Thanks for your help!


Reply With Quote
