I want to disable the stack trace generated when an exception is thrown. I used
Runtime.getRuntime().traceInstructions(false); Runtime.getRuntime().traceMethodCalls(false);
but still, I could see how the trace is generated. How can you do this? I also need to determine if anyone is debugging my class.
I want to disable all traces of exceptions. I can not use obfuscation, since my product is an SDK that will be used in development. I also suggest Runtime, which is used when people want to deploy their applications created using my SDK. My requirement is that anyone using my Runtime banners should not debug the code that is written ... or at least I will make it difficult to debug it by avoiding generating a stack trace from my runtime banners.
One of the ways I found is that all the exceptions that arise from my java files, I just caught them and set an empty StackTraceElement array for the exception object and threw it again ...
Why such a requirement? Suppose you have developed an application using my SDK. (SDK banks cannot be combined with your application .. I limited it, and this is final :)!) Now, to run your application on your client machine, you (or the client) need to set the Runtime on the client machine and launch the application. Now, what if your client starts developing their own applications using my Runtime jars !! This is a threat to my business .... That's why a terrible demand.
Why disable stack tracing?
By disabling stack trace generation or method invocation trace generation, I wanted to make the development code with my Runtime banks difficult and that is why I started my question this way ... I propose another solution to achieve this requirement ...
java debugging stack-trace
AD.
source share