开发者

Java debugging tool [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

Q开发者_运维百科uestions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.

Closed 8 years ago.

Improve this question

I have written a program that consists of roughly 3000 lines of code. The program works correctly to my knowledge. Is there any tool available which I can download that will help me verify my code is working correctly as well suggest how to optimise it?

Thanks


For verifying you should consider writing tests. JUnit would be the obvious choice for that. TestNG a popular alternative.

For optimising, you might consider checkstyle, findbugs and PMD. Won't do much for performance, but might give some hints for general improvements of code style.

If you are really concerned about performance you might consider a profiler. Just google profiler + java and the IDE of your choice to find appropriate tool support.

But don't forget: premature optimization is the root of all evil.


Jens' answer points you to several very useful tools for static code analysis, but they have the same limitation. I read the "working correctly" part of your question as a reference to code verification, i.e. something like "can you prove this code does this thing". Testing can only do so much. Formal methods for verification are a pretty large research area, look it up if that is what you meant.


For general java development, you can use NetBeans or IntelliJ IDEA, both available at no cost.

Both IDEs have support for JUnit, which allows you to write unit tests to exercise and verify your code. Also, they both feature built-in debuggers so you can step through the code to see that it performs as you expect. Finally, they both support refactoring, which can help you improve the design of your code.

Programming is still an art rather than a science, so there is no tool that can generally suggest improvements to making the code run faster. Instead, use a profiler, such as the NetBeans profiler, which can identify where the time is being spent on your code, and help guide your optimization efforts.

For CPU bound tasks, faster execution in Java can be achieved by using the server HotSpot VM (-server option), tweaking the VM parameters, and compiling with no debug info (-g:none).

See

  • HotSpot Options
  • IntelliJ IDEA
  • NetBeans
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜