Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Java
  4. creating a class with coding_?.

creating a class with coding_?.

Scheduled Pinned Locked Moved Java
javavisual-studiohelptutorialquestion
8 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    quartaela
    wrote on last edited by
    #1

    hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).

    L J D 3 Replies Last reply
    0
    • Q quartaela

      hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      quartaela wrote:

      you will say i am working on a silly project

      No, you said that.

      Unrequited desire is character building. OriginalGriff

      Q 1 Reply Last reply
      0
      • L Lost User

        quartaela wrote:

        you will say i am working on a silly project

        No, you said that.

        Unrequited desire is character building. OriginalGriff

        Q Offline
        Q Offline
        quartaela
        wrote on last edited by
        #3

        well ok you are right : ). i will delete the topic .

        1 Reply Last reply
        0
        • Q quartaela

          hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).

          J Offline
          J Offline
          jschell
          wrote on last edited by
          #4

          Createing code at runtime and then compiling it is possible. Certainly sounds like you are missing the second part of that. You can find examples of that. However nothing in your post really suggests why you need that.

          Q 2 Replies Last reply
          0
          • Q quartaela

            hi there i am working on a project that my goal is when i run my code it will create another file(classes) (exp: personalList.java) and user must associate with second file. for example; i have a file "PersonalDatabaseCreator.java" and this file creates "Person.java" (which is my object and includes properties getters setters etc.) and "PersonalList.java" which user will interact. (PersonalList.java ask the location of the text file which contains people to add into a LinkedList. Therefore, user will do add search remove etc. operations). but the problem it only works when i create classes in IDE myself and copying the code into them and run them. so i need a code which will do it itself!. you will say i am working on a silly project : D. but i wonder if is there any code samples like this_?. and i hope i explained my problem correctly. so thanks anyway : ).

            D Offline
            D Offline
            David Skelly
            wrote on last edited by
            #5

            Yes you can do this. Java 1.6 has an interface JavaCompiler that lets you call the compiler from within code. There is an article here: The Java 6.0 Compiler API[^] Depending on what you are trying to achieve (it's not entirely clear to me), you may find something like BeanShell a better solution. BeanShell[^]

            Q 1 Reply Last reply
            0
            • J jschell

              Createing code at runtime and then compiling it is possible. Certainly sounds like you are missing the second part of that. You can find examples of that. However nothing in your post really suggests why you need that.

              Q Offline
              Q Offline
              quartaela
              wrote on last edited by
              #6

              yess i mean this. well i am taking java courses and i want some java homework so he told me that i can work on this subject.: )

              1 Reply Last reply
              0
              • J jschell

                Createing code at runtime and then compiling it is possible. Certainly sounds like you are missing the second part of that. You can find examples of that. However nothing in your post really suggests why you need that.

                Q Offline
                Q Offline
                quartaela
                wrote on last edited by
                #7

                yess i mean this. well i am taking java courses and i want some java homework so he told me that i can work on this subject.: ) finally i created the code and it creates the files which must be compiled. so only the problem is how can i compile them : )

                1 Reply Last reply
                0
                • D David Skelly

                  Yes you can do this. Java 1.6 has an interface JavaCompiler that lets you call the compiler from within code. There is an article here: The Java 6.0 Compiler API[^] Depending on what you are trying to achieve (it's not entirely clear to me), you may find something like BeanShell a better solution. BeanShell[^]

                  Q Offline
                  Q Offline
                  quartaela
                  wrote on last edited by
                  #8

                  well i will have a search on these links. thanks mate : )

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups