0
Edit and run java file on computer
Hi everyone, I am a beginner of Java, I am learning and practising, but I don't know how to save a Java code and run it. I have learnt HTML and could edit in Notepad then save with .html extension, then I can open the file easily; however, I save a Java code with .java extension but I cannot open the file. Hope to receive your help.
7 ответов
+ 2
For developing Java on PC, you first need to download both the JRE(Java runtime environment) and the JDK(Java development kit) from Oracle.com, you then need to download an IDE (something like Eclipse or Netbeans) to compile your codes into executable files and to assist you with debugging and all what an IDE is supposed to bring.
+ 1
I downloaded this link (https://java.com/en/download/win10.jsp) but it didn't help, is it wrong? Will it be OK if I uninstall it and search to download JRE, the JDK and IDE? If possible, can you please send me link of these 3 items to download? I'm just afraid that I download wrong ones.
+ 1
yeah it's ok Java is owned by Oracle so whether you download from java.com or Oracle.com, it's indifferent. As for the download links, I can't really send you the right ones since I dont know whether you have a 64 or 32 bit system. Just refer to a video on YouTube on how to install these and you should be good to go.
0
Thank you very much, I will search for it.
0
You don't need any IDE just the jdk bundled with the jre. When you installed the JDK, switch in your java folder (where the JDK was installed). There should be a javac.exe and a java.exe, which you can use on your own.
Now you just move your .java file in this java folder with the 2 .exe and launch a terminal there. Now you type:
javac yourfile.java
This generated a .class file: A compiled byte code generated by the java compiler from your .java.
To run your byte code type:
java yourfile.class
This fires up the JVM which interprets (or JIT compiles) your byte code and exexutes it.
No need to use an IDE at the beginning.
0
Why complicate your coding life when you can make it easier, using an IDE is not rocket science. Plus it greatly helps to situate and organize yourself. I'd rather do that early to familiarize myself with the interface of the program. Hit two birds with one stone.
0
Of course an IDE helps, but don't you want to know what the IDE exactly automates to run a java file?