-6

I wanna develop apps that can compile a java code from editText. So the user write code in editText and if i click the button, programm will compile the text from edit text and show the result in textView. i found the app similar i mean such as AIDE. is there anyone can help me solution to build apps like this?

Enamul Hassan
  • 5,266
  • 23
  • 39
  • 56
  • You're asking us to build a compiler as Android app? SO is for asking specific questions, we aren't here to write free apps for you. You need to visit this link if you want apps built for you: https://www.upwork.com – leonz Aug 21 '16 at 14:30
  • i mean, i want to compile a java code that i got from edit text in android studi? for now i can compile java file in android studi. but i don't know how to compile the code from edit text. may be is there any solutio for me? – Abdul Aziz Aug 21 '16 at 15:00
  • there is no simple solution for this. Go and study computer science, maybe you'll be able to write that java compiler afterwards. – Chris623 Aug 21 '16 at 15:05

1 Answers1

1

How about saving user's code somewhere in the device as .java file and then running shell command for compiling file and processing user's code. refere below code

try{
Process su = Runtime.getRuntime().exec("su");
DataOutputStream outputStream = new DataOutputStream(su.getOutputStream());

outputStream.writeBytes("screenrecord --time-limit 10 /sdcard/MyVideo.mp4\n");
outputStream.flush();

outputStream.writeBytes("exit\n");
outputStream.flush();
su.waitFor();
}catch(IOException e){
    throw new Exception(e);
}catch(InterruptedException e){
    throw new Exception(e);
}

Not providing required shell commands for the purpose as they would vary language to language but easy to explore.

Other option could be to call some online service that can do the compilation and provide the result.

Community
  • 1
  • 1
Nayan Srivastava
  • 3,655
  • 3
  • 27
  • 49