multithreading - Is it possible to have a program that runs code from another program (.java file) and automatically debugs each line -


For example, I can say that I want to create a generic program that creates threads to run code from a .java file, says in a JFileChooser, and it can either line one line up to a certain line Runs, and prints each change from the debugger, or at least functions such as (IE prints the data inside the data structures and the variable)

While writing this, it is a normal IDE Feeling like Or something else that I'm just running and debugging it myself, but I say that instead of going through every step I want an easy way of debugging, look at the debugger, scroll down, I want to see, expand on it, then scroll down, etc. Most of the time when I debug, I get a lot of information that does not really care about me, so I want to limit it in all properties, rather than just values, rather than its properties, etc.

It looks like a big project, or maybe it's not really and is really simple in any way, I want to make a project ... 1. A thread that is a specified Runs the .java file

2. A thread that changes the value in the first thread (To make it easier, I could have just put a GUI and it could update each value and step. IE (string [] names => [], [" Joe shmoe "], [" Joe Smell "," Clay Stanley "], [], etc.)

3. It has the ability to read the line by line, or at the very least, Record changes that I can do so, go back and see it.

4. Throw any errors, say, A And the textbox that contains the stacktrace.

I want to know what this is possible, and if so, to start. If I manage to do this, The project helps to debug. "Itemprop =" text ">

You can not debug Java files. However, what you can do is compile those files and output your customized diagnostics. ! You will also be deemed to be able to apply yourself (although you do not need it).

Do you want to read about utility? Quotations explain things very well, I think, but if you look down on them (like I did back in the day), then whatever you can not understand, Google can only do it. There are so many examples and tutorials.

This is my personal project:

  Public Boolean Compilation () {Diagnostic Selector & lt; JavaFileObject & gt; Diagnostic = New Diagnostic Collector & lt; & Gt; (); Try {JavaCompiler compiler = ToolProvider.getSystemJavaCompiler (); Try (standard_file manager filemanager = compiler.getStandardFileManager (empty, null, void)) {iterable  

This will not compile the shelf, but you should give it a good boost.

Here is an example of what you can do with the diagnosis given here:

  Personal Boolean Successful Employment (List & Lt; Diagnostic & lt;? JavaFileObject & gt; ; Provides diagnostics) {if (! Diagnostics.isEmpty ()) {boolean errors = false; Try (diagnostic.getKind ({diagnostic & lt;? JavaFile object & gt; diagnostic: diagnostics} for printwriter author = new print-witter ("compiler.", "UTF-8" == Diagnostic Kendra. {Errors = true;} Author. Print ("Code:" + diagnostic.getCode ()); Writer.println ("Type:" + diagnostic.getKind ()); Writer.println ("Source Writer.println ("Message: }} Hold (FileNotFoundException | unsupported encoding exceptions) {System.out.println ("Could not write compilation log:" + ex.getMessage ());} if (errors) {System.err.println ("compiler has ended with errors."); Details are false ;} System.err.println ("has finished with compiler warnings.");} Back true;}  

Comments