/    Sign up×
Community /Pin to ProfileBookmark

need some help in JAVA programming

good day…

i am in need of advice and help regarding the java compiler and
interpreter.

i am currently working on a project (a simple tutoring system in
java). i wanted to know and/or learn a way on how to include the java
compiler and interpreter within the program i am developing right now.
for example i have two buttons, one that compiles and one that runs a
pre-defined program.

is there any code, way(s) or method(s) that makes this possible?

thanks in advance…

-kit

to post a comment
Java

3 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliOct 25.2004 — you can use Runtime class for such tasks(I am sure,though did not run a java command using this)

Runtime process = Runtime.getRunTime().exec("javac className.java >ouput.log");

something along those lines, I did not text the code.It should run the javac command(to compile the code) and then it should put the out put in the output.log file.Which you can read by File object etc..etc..
Copy linkTweet thisAlerts:
@ray326Oct 25.2004 — You might want to check out the source of [URL=http://www.alphaworks.ibm.com/tech/robocode]Robocode[/URL], which does something similar to what you're wanting to do.
Copy linkTweet thisAlerts:
@krcsauthorOct 26.2004 — your help is much appreciated....thanks again...ill try to work on that solution...

and for those who will read my posted message,if you have some solutions or advices in mind that could be able to help me,i would gladly appreciate it..thanks again and good day.

  • - kit
  • ×

    Success!

    Help @krcs spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 5.6,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...