Is it possible to run a file with Java code only? I don't mean to read and write but actually running it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to run a file with Java code only? I don't mean to read and write but actually running it.

6th Apr 2020, 9:59 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
4 Answers
+ 2
If you have the byte code then it is possible because .java file has to be first compiled to get a .class file which can be executed on any OS dependent JVM. Also only JRE is enough to run or execute an already compiled code.
6th Apr 2020, 10:02 AM
Avinesh
Avinesh - avatar
+ 2
Eliya Ben Baruch I guess you mean something like this: https://stackoverflow.com/questions/10685893/run-exe-file-in-java-from-file-location I would search for "run exe file with java" on google.
6th Apr 2020, 10:05 AM
Denise Roßberg
Denise Roßberg - avatar
+ 1
Denise Roßberg Thanks I will look later
6th Apr 2020, 10:20 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar
0
Avinesh No, I meant to run for example an .exe file but with Java code, to write a program which will do it.
6th Apr 2020, 10:05 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar