how to compile n run 'C' code in java notepad made by me???

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • suhasmahajan85
    New Member
    • Feb 2008
    • 2

    how to compile n run 'C' code in java notepad made by me???

    hi

    I HAVE MADE SIMPLE NOTEPAD IN JAVA WITH FILE EDIT AND DEBUG COPILE N RUN OPTIONS

    FILE AND EDIT ARE WORK SUCCESSFULLY

    BUT NOW I WANT TO COMPILE AND RUN THE 'C' CODE THROUGH THIS NOTE PAD ???

    HOW CAN I DO IT
    PLEASE HELP ME

    send me mail also on <EMAIL REMOVED BY MODERATOR>
    Last edited by suhasmahajan85; Feb 26 '08, 02:00 PM. Reason: send me mail aslo
  • sukatoa
    Contributor
    • Nov 2007
    • 539

    #2
    Originally posted by suhasmahajan85
    hi

    I HAVE MADE SIMPLE NOTEPAD IN JAVA WITH FILE EDIT AND DEBUG COPILE N RUN OPTIONS

    FILE AND EDIT ARE WORK SUCCESSFULLY

    BUT NOW I WANT TO COMPILE AND RUN THE 'C' CODE THROUGH THIS NOTE PAD ???

    HOW CAN I DO IT
    PLEASE HELP ME

    send me mail also on .
    You may want to know this first...
    Last edited by RedSon; Feb 26 '08, 03:30 PM.

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      1.) Posting emails is against site rules.
      2.) Do you want to create a C compiler using Java or do you have some C compiler already that you want to invoke?

      Comment

      • sukatoa
        Contributor
        • Nov 2007
        • 539

        #4
        If you have the C compiler,

        Read about Process and Runtime...

        and try some experiments on it...

        Comment

        • suhasmahajan85
          New Member
          • Feb 2008
          • 2

          #5
          Originally posted by r035198x
          1.) Posting emails is against site rules.
          2.) Do you want to create a C compiler using Java or do you have some C compiler already that you want to invoke?
          NO I DONT WANT TO CREATE C COMPILER I JUST WANT INVOKE IT FROM TC FOLDER

          BUT HOW TO DO IT????

          Comment

          • JosAH
            Recognized Expert MVP
            • Mar 2007
            • 11453

            #6
            Originally posted by suhasmahajan85
            NO I DONT WANT TO CREATE C COMPILER I JUST WANT INVOKE IT FROM TC FOLDER

            BUT HOW TO DO IT????
            Read reply #4 and please turn off your caps lock; you are shouting.

            kind regards,

            Jos

            Comment

            • BigDaddyLH
              Recognized Expert Top Contributor
              • Dec 2007
              • 1216

              #7
              Originally posted by JosAH
              Read reply #4 and please turn off your caps lock; you are shouting.

              kind regards,

              Jos
              Id rather do it in Java:

              [CODE=Java]import java.awt.*;
              import java.awt.event. *;

              public class TryThis {
              public static void main(String[] args) {
              Toolkit.getDefa ultToolkit().se tLockingKeyStat e(KeyEvent.VK_C APS_LOCK, false);
              }
              }[/CODE]

              Comment

              • JosAH
                Recognized Expert MVP
                • Mar 2007
                • 11453

                #8
                Originally posted by BigDaddyLH
                Id rather do it in Java:

                [CODE=Java]import java.awt.*;
                import java.awt.event. *;

                public class TryThis {
                public static void main(String[] args) {
                Toolkit.getDefa ultToolkit().se tLockingKeyStat e(KeyEvent.VK_C APS_LOCK, false);
                }
                }[/CODE]
                That's cute; I found that one myself a couple of months ago (I don't really like
                Swing's API docs, I always get lost in it). I haven't found anything similar yet
                for insert/overwrite when the 'insert' key is pressed. Any ideas?

                kind regards,

                Jos

                Comment

                • BigDaddyLH
                  Recognized Expert Top Contributor
                  • Dec 2007
                  • 1216

                  #9
                  Originally posted by JosAH
                  That's cute; I found that one myself a couple of months ago (I don't really like
                  Swing's API docs, I always get lost in it). I haven't found anything similar yet
                  for insert/overwrite when the 'insert' key is pressed. Any ideas?

                  kind regards,

                  Jos
                  I think you're out of luck there. I so never need that key that I typically take a pair of pliers and pull it off the keyboard. Problem, solved.

                  Comment

                  • sukatoa
                    Contributor
                    • Nov 2007
                    • 539

                    #10
                    Originally posted by suhasmahajan85
                    NO I DONT WANT TO CREATE C COMPILER I JUST WANT INVOKE IT FROM TC FOLDER

                    BUT HOW TO DO IT????
                    Just like i said, if you have the C compiler, then you can invoke it...

                    When you read and follow my first reply, then you will discover more of it...

                    After compiling, you can invoke the generated .exe file...

                    WARNING:
                    Invoking executable with the combination of Process and Runtime is a good implementation for me, except when you invoke a .COM file that was generated from A86 Compiler (Assembly language)... it does nothing... I've posted the "invoking .COM file" in this forum if you are confused...

                    I tried many pattern's on .exec() method, but i got nothing....
                    Some experts told me last 2 months i think JoshAH or BigDaddy, about javax.tools, it also helps me....

                    If you use javax.tools, another lines of code will be added,

                    and if you use Process and Runtime, the CMD will do the rest....


                    I hope it helps,
                    Sukatoa...

                    Comment

                    Working...