Ask your own question, for FREE!
Computer Science 16 Online
rvc (rvc):

How can i get a java complier for linux and ubuntu?

rvc (rvc):

@sasogeek @wio

OpenStudy (anonymous):

google will help best type in adobe

OpenStudy (rsmith6559):

As root: yum install java-1.7.0-openjdk java-1.7.0-openjdk-devel I also have: gcc-java which is a Java frontend for gcc, so that standalone executables can be compiled. No jvm needed.

rvc (rvc):

so i have to install java -1.7.0-openjdk java-1.7.0-openjdk-devel? this will work for both? @rsmith6559

rvc (rvc):

@Jaynator495

OpenStudy (opcode):

YUM is for Red Hat like distros if I recall correctly. Ubuntu uses apt-get, the following commands work for installing JRE, and JDK. ``` sudo apt-get update sudo apt-get install default-jre sudo apt-get install default-jdk ``` After installing, you may want to check out ```java -version``` to know what version you are working with.

rvc (rvc):

i should type this in terminal

OpenStudy (opcode):

Yup.

rvc (rvc):

i gave the 1st command

rvc (rvc):

i opened the link

rvc (rvc):

now?

rvc (rvc):

The program 'java' can be found in the following packages: * default-jre * gcj-4.8-jre-headless * openjdk-7-jre-headless * gcj-4.6-jre-headless * openjdk-6-jre-headless Try: sudo apt-get install <selected package>

OpenStudy (opcode):

Run the command: sudo apt-get install default-jdk

rvc (rvc):

look Need to get 61.7 MB of archives. After this operation, 106 MB of additional disk space will be used. Do you want to continue? [Y/n]

OpenStudy (opcode):

Hit the 'y' key, and then hit enter.

rvc (rvc):

okay

rvc (rvc):

its showing that % symbol

rvc (rvc):

so it should be 100% till then we have to wait right

OpenStudy (opcode):

Yup, currently it is fetching the files. Once that is done, it will install them.

rvc (rvc):

okay could you wait?

rvc (rvc):

like if u r free then

rvc (rvc):

ah i see u dont accept messages you may be knowing java, python and all right

OpenStudy (opcode):

After the command finishes you will have the full featured Software Development Kit for Java. There really is not much else to it. There is not supposed to be any accept messages.

rvc (rvc):

what will be the name of the application?

rvc (rvc):

Adding debian:GTE_CyberTrust_Global_Root.pem done. Setting up libatk-wrapper-java (0.30.4-4) ... Setting up libatk-wrapper-java-jni:amd64 (0.30.4-4) ... Processing triggers for libc-bin (2.19-0ubuntu6.6) ... Processing triggers for ca-certificates (20141019ubuntu0.14.04.1) ... Updating certificates in /etc/ssl/certs... 0 added, 0 removed; done. Running hooks in /etc/ca-certificates/update.d.... done. done.

rvc (rvc):

now it shows the command again

OpenStudy (opcode):

To compile you can use: javac filename.java To run your Java program you can use: java filename

rvc (rvc):

so i should type the commands in terminal

rvc (rvc):

or in pluma?

OpenStudy (opcode):

Well do you have Java source code to compile?

rvc (rvc):

ah im totally new to this

OpenStudy (opcode):

Oh, okay. Well, javac is the java compiler, notice the c on the end of java which denotes that that command calls the Java compiler. java is the command used to run Java programs, after they have been compiled.

rvc (rvc):

okay well javac will run the java commands right

OpenStudy (opcode):

When you say Java commands do you mean, compile the Java source code of a file, into a binary executable that you run, then yes.

rvc (rvc):

yay okay well how can i create a java file?

OpenStudy (opcode):

Do you mean create programs? Before that, you have to learn Java programming.

rvc (rvc):

yeah but where can i create so that i can use javac

OpenStudy (opcode):

Open up a text editor, write a simple, "Hello World" program in Java, save it as HelloWorld.java Then go inside your terminal, locate where HelloWorld.java is, and cd into that directory, then run javac HelloWorld.java, which will compile your source code.

rvc (rvc):

oh so i need text editor

rvc (rvc):

Pluma will work?

OpenStudy (opcode):

Is Pluma a text editor? If so then yes, virtually any text editor works.

rvc (rvc):

how ? like i saved it on desktop what should i type? javac hello.java

OpenStudy (opcode):

What did you save it as?

rvc (rvc):

Hello.java on desktop

OpenStudy (opcode):

cd ~/Desktop javac Hello.java

rvc (rvc):

no not working

OpenStudy (opcode):

What does it say?

rvc (rvc):

javac: file not found: Hello.java

OpenStudy (opcode):

Did you cd into the directory where you saved the file?

rvc (rvc):

well what does that mean?

OpenStudy (opcode):

Did you run this command: cd ~/Desktop cd means, change directory it is a command line way to switch between directories.

OpenStudy (opcode):

@rvc I have to go, hopefully in the mean time someone else can try to help you out. Good luck.

rvc (rvc):

okay thank you so much for help @Opcode

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!