+ 5

How to compile java program using Runtime class?

suppose I write a Java program Hello.java how can I compile and execute it with the help of Runtime class?

9th Nov 2017, 5:07 AM
Shubham Nainwal
Shubham Nainwal - avatar
10 Respostas
+ 3
public class GFG { public static void main(String[] args) { // get the current runtime assosiated with this process Runtime run = Runtime.getRuntime(); // print the current free memory for this runtime System.out.println("" + run.freeMemory()); } }
9th Nov 2017, 10:48 AM
Raj Sah
Raj Sah - avatar
+ 3
@ ahmet samet baltaci i do not want to run program by using command prompt. I want to write a Java code that is used for executing Java code.
11th Nov 2017, 2:23 AM
Shubham Nainwal
Shubham Nainwal - avatar
+ 3
@anisha thank u Ji..aur ye hi bat tumari HTML k liye... :)
25th Nov 2017, 5:06 PM
Shubham Nainwal
Shubham Nainwal - avatar
+ 3
@anisha abi KB tak hain tumare exam??
25th Nov 2017, 5:10 PM
Shubham Nainwal
Shubham Nainwal - avatar
+ 3
@anisha okie WhatsApp b off h tab tak tumara??
25th Nov 2017, 5:26 PM
Shubham Nainwal
Shubham Nainwal - avatar
+ 3
@anisha hehe aley..Mene wtsapp num dala tha code me kisi ka reply ni aya to code hi remove kr diya..
25th Nov 2017, 5:30 PM
Shubham Nainwal
Shubham Nainwal - avatar
+ 3
goddiieenightt Ji :)
25th Nov 2017, 5:39 PM
Shubham Nainwal
Shubham Nainwal - avatar
+ 1
use netbeans to run your javaprograms
26th Nov 2017, 3:20 AM
Geevarghese Yohannan
0
Hi First of all go to app path on terminal(Hello.java) after then write "javac Hello.java" this code compile your app and if this statement is true write "java Hello.java"
10th Nov 2017, 9:36 PM
Ahmet Samet Baltacı
Ahmet Samet Baltacı - avatar
0
sahi hai !!!!
25th Nov 2017, 6:33 PM
Raj Sah
Raj Sah - avatar