I was just given a java project to support. The code is just a bunch of pojo's that reads local files, creates bundled files similar to a tar file, writes them to memory and then shutdown. In prod they are kicked off with one bash script that reads a config file then kicks off the jar (compiled code from the java project) file. When the compiled code returns control to the 1st script it then kicks off another bash script that moves the output of the compiled code to an hdfs (hadoop) cluster. How would I debug this code while using all the bash scripts and the config file? I can kick off java project with some of the inputs it requires but the bash scripts are very complicated and pass around several variables. It would be nice to able to load the scripts into eclipse, kick off the scripts, debug them and when they call the java code, step into that. Any thoughts on how to do this?
You could have the bash scripts start the VMs used to run the jar files in debug mode. You could then remotely debug the jar files using the Eclipse remote debugging feature.
Thanks for the response. I must admit I don't know how to do what you are suggesting. If you could, would you please give a bit more detail on how to do what you are suggesting?
Your bash scripts need to invoke the Java VM in order to run the jar files. You can add the arguments to start the VM in debug mode. The VM will then start and wait for a debugger to connect to it. In Eclipse, you can use the remote debug feature (Run->Debug Configurations->Remote Java Application) to connect up to the debug VM and then use the debugger as you would in Eclipse.
This is a pretty advanced topic, but then what you are trying to do is pretty advanced. You need to check the VM documentation to get the correct arguments to start the VM in debug mode. There is also a Remote Debugging section in the Java development user guide in the included Eclipse documentation.