Accessibility of test coverage reports for blind people - java

I am currently helping a member of my team to get in grip with our new project and the tools we are using. We use Java as a primary language. A particularity of my colleague is that he is blind. He's working primarily with Emacs, and he runs maven targets in a terminal.
After I'm done implementing, I find it very useful to check my test coverage. I'd like my colleague to be able to check coverage as well. I have two ways of getting this information:
Use IntelliJ integrated test coverage (it uses EMMA and shows a green, red or yellow color next to each line). Very convenient, as I can see this information immediatly after having run the tests, with no further interaction
This won't work for my colleague as he can't use IntelliJ, and it would probably not work anyway as there is no textual representation of the coverage info
Use Cobertura reports. They use the same concept of line in green/red They are fine for macro information like overall coverage in a class, but not for checking which line has not been covered.
Actually he could dig into the HTML sources of the report and find out which one has class nbHitsUncovered, but it seems very impractical.
I would really like to show him how to get his coverage data quickly. Does anybody know of a tool that shows coverage without relying on colors? Or do we have to write our own? (by transforming the HTML report, for instance)

I’m a totally blind developer who does my work on Windows with the Jaws for Windows screen reader so this won’t map exactly to the developer you work with. With a little programming it looks like cobertura test results are the easiest to deal with. Based on the following sample XML report it shouldn’t be difficult to throw together a quick Perl script to check for lines with a hit count of 0.
https://raw.github.com/jenkinsci/cobertura-plugin/master/src/test/resources/hudson/plugins/cobertura/coverage-with-data.xml
I was able to find out that line 24 was the only one executed 0 times with a quick find for
Hits="0"
Although I was able to find out what line wasn’t executed I had to scroll up quite a bit to figure out what class and method the line was located in. A quick Perl script could eliminate the need to scroll back and provide the package, class, and method the line is located in more efficiently.
I took a look at a sample Emma HTML report using Google Chrome and it was pretty accessible. I could tell what methods were fully tested and what weren’t. Figuring out what lines were executed and what ones weren’t was more difficult. I could tell a method wasn’t 100% executed and would then navigate to it in the report. I then had to use the keystroke provided by my screen reader to announce color on each line of code. I forget the exact color names but I could tell the lines that were and weren’t executed since my screen reader listed them as having different colors. This worked but was slow since I had to manually check each line of a method; that wasn’t completely executed since my screen reader can’t automatically announce color changes. I’m not sure how your developer would do the equivalent since I don’t know his exact assistive technology setup.

I have had a dig around Antoine as I also use SONAR and Cobertura on my projects and am intrigued by your problem. From what I can see when you tell the ANT task to generate "html" as the output you get all the line information that want, but as you've pointed out it's not an easily parseable format (and possibly subject to change).
With SONAR I tell Cobertura to output "xml" which gives me a file named coverage.xml with the output. Unfortunately it does not include line-by-line data and I cannot see any ANT task parameters to include it from the Cobertura docs.
It makes sense to me that the file named cobertura.ser contains all of the data you require, but only the HTML report displays it for you. I believe the answer to your question may lie in trying to extract the required serialised data from cobertura.ser.
Looking at the source code I can see the following classes
net.sourceforge.cobertura.reporting.html.HTMLReport
net.sourceforge.cobertura.reporting.xml.XMLReport
What I suspect you can try and do is take a copy of the HTMLReport as a base and try writing the same output as XML which you can then parse for your own purposes (or mjust ad the same method calls used by HTMLReport in XMLReport). I can see the string nbHitsUncovered in HTMLReport so hopefully you only have one class to write.
I've googled around and can't see anyone having done this, but it looks like a useful enhancement.

How about using a GreaseMonkey script that searches all the lines having the class nbHitsUncovered and adds some list/table containing the information wanted to the report?

Related

Printing up a line in java console (reverse of '\n')

Foreword
I've seen some questions related to this in other languages and done quite some research on this. First, before we begin going down the rabbit hole, I must describe why I'm doing this. I'm pretty printing a binary tree and I found a way to do it that I don't think anyone else has found (can't find it anywhere on the web I've searched forever). It solves a lot of the problems related to spacing and conflicts and I'll probably provide it as an answer to prettyprint Btree questions later. Anyways, an essential part of doing the above is to be able to move the line feed (the cursor) one line up. I will also settle for moving the carriage return one line up.
I have made three EDITs to this question named "Edit 1-3" near the bottom.
My specific Windows version (might be relevant): Windows 10 v1607
OS build: 14393.2035
The problem??
The problem is that this is easily done with ANSI escape characters
ANSI escape codes: https://en.wikipedia.org/wiki/ANSI_escape_code
With "\033[A" being the specific code I want to implement (got it from a question about moving one line up in python).
The problem
So problem solved right? Oh no, not even close. The problem is, apparently windows had this """wonderful""" update that may have broke everything ANSI/console related. The below links to a question about this but with different ANSI requirements however the root problem is the same.
How to print color in console using System.out.println?
tl:dr It doesn't work for windows for some reason, you need a big library to do this or something else.
Sooo then I tried doing some in-depth research on the update itself and why this happens to be windows specific (of course) and I was led to this.
the root cause of windows problem: https://github.com/Microsoft/WSL/issues/1173
tl;dr:
Basically, the update changed a default setting for cmd.exe which is the default console that java uses. What changed was how the console setting for ANSI codes are processed for 'child applications' AKA java (stuff that uses the console but isn't console itself). The default Before the update was that child applications inherited the default of console which was to have ANSI enabled. NOW (because apparently, the previous default broke things) they changed it so that child applications DO NOT inherit the default settings from the console. This means java has to effectively set this console mode itself if java wants to have ANSI enabled. There are obviously a plethora of libraries for the java command to do that but of the good available ones, there are some issues. Firstly they require maven and I don't want maven, also I don't like NEEDING a million extra libraries to do something very simple and it adds to the number of things my code relies on (which is bad). So I'm trying to avoid simple solutions like "just use JANSI" to setConsoleMode for ANSI.
What I've tried after this
after I was done reading/understanding that I tried going into my Registry Editor and trying to change the default setting of the console (cmd.exe) to always enable ANSI even for child applications (AKA java). It had been suggested in the GitHub discussion but to my surprise the specific setting wasn't even there for me. (it was supposed to be in Computer -> HKEY_CUURENT_USER -> Console between "TrimLeadingZeros" and "WindowAlpha").
Try 2
Since I couldn't edit the console setting without big libraries full of things I don't want, I tried thinking outside the box and I messed around in java settings. I discovered where exactly java sets it's console and discovered that I could change that setting to use a different console in java. I had recently installed git and known that git bash was available so I tried that using the below question (and google in general) as a starting point.
https://superuser.com/questions/1196463/start-sh-exe-bash-with-given-path
Third time is the charm?
I couldn't get the darn thing to work. It didn't return any errors or do anything new, like at all. It was even set 'for the current project' so it should've done something different when I ran my project no? I believe part of the problem is that my root git folder is screwy (not in program files). This is probably because the computer I'm using is a work computer and maybe some setting there affects where git was installed, I don't know but what I do know is that when I changed consoles I tried this path:
C:\Users\abbotts1\AppData\Local\Programs\Git\bin\bash.exe
I also tried:
C:\Users\abbotts1\AppData\Local\Programs\Git\bash.exe
and
C:\Users\abbotts1\AppData\Local\Programs\Git\bin\sh.exe
and
"C:\Users\abbotts1\AppData\Local\Programs\Git\bin\sh.exe" --login -i
And after each change of console I tried this code:
public class ExpressionEvaluator {
public static void main(String[] args) {
System.out.println("1");
System.out.println("\033[A");
System.out.println("2");
}
}
And I always got:
1
Extra Line here
2
As the output. If I removed the 'move cursor up' ANSI println statement attempt I got:
1
2
What I wanted was:
2
1
(the whole point being, I'm able to move up a line freely)
I've also tried making them print statements and that didn't work either.
So I'm now at wits end
So here is what I want, an answer something like:
A nonintrusive way to change the setting for cmd.exe to allow child applications like java to use ANSI BY DEFAULT when ran
OR a nonintrusive library that doesn't require maven and a million other things to enable ANSI so I can run the ANSI in java in the console and get my desired output
OR a programmatic workaround that allows me to effectively print one line up without this whole ANSI thing
OR help to configure IntelliJ console so that I can actually use a different console and use ANSI to print one line up
To address the obvious concerns
Since 1 and 4 are superuser questions and 2 is 'I need a library' and offtopic I'm more talking about point 3 here. If there is no workaround for this and the answer is one of the offtopic ones just tell me there is no workaround. I don't know how else to ask this question since it is a 'programming specific problem' it just has many solutions some of which are not 'on the topic' because they aren't programming solutions. If the only answer is 'the solution isn't on topic here' then I'll go ask in the appropriate place. Let me know if I should delete this question when I go to ask it somewhere else.
What I think might work for on topic part of this
Since 3 is on topic here I'll discuss what I'm thinking:
Maybe I could make some sort of system to print only to certain arrays instead of moving up and down lines (i.e. have an array to represent the lines, traverse the tree and instead of moving up and down lines, just switching the array to print to). I don't see this as very efficient and Its kind of a waste of arrays and processing power but if its a solution I'm willing to hear it. That's all I can 'think of' but most of what I've tried is trying to get ANSI to work.
For future reference:
what is the appropriate way to ask these questions with multiple off-topic solutions/ solution questions? Is it better just not to ask them at all? Do solutions that involve questions constitute a chameleon question? I don't feel like bringing the meta effect upon myself.
Edit 1: where I'm at so far:
I've tried the whole git bash thing again and boy was it a process. The actual git bash path in the terminal needs to be in quotes with the --login -I arguments coming afterward. Ex:
C:\Git\bin\sh.exe --login -i
This setting is for the java terminal. THEN you have to set a windows environment variable named PATH to your java JDK. Go to your path environment variables (there are a million and one youtube videos for that) and set a new variable named PATH to your JDK. Ex:
C:\Program Files\Java\jdk-10.0.1\bin
This question:
How can i make gitbash find the javac command?
Goes through that process extensively
Tl;dr You have to set a windows path variable this in order for git bash to recognize the javac and java commands.
Once that's done you need to actually run your java and javac commands like you would in any terminal. BTW be careful because paths in git bash require a two '\' notation instead of the normal '\' so your source directory path might look like this:
C:\IdeaProjects\Calculator\src\
Then you just run:
javac ClassName.java
java ClassName
BUT THEN it doesn't actually print the ANSI output, it prints the raw escape characters. Also, I found out I was using the WRONG escape sequence (I had the wrong number to represent the 'esc' button since the 'esc' key is represented as some number, but I had the wrong hex number I was using like x330 or something). I also learned that the notation is like this:
'esc key hex number' + '[' + 'parameter hex values separated by commas'
so this might look like:
\x1B [ A
where the actual letters and numbers are hex value stuff (without the obvious 0x...) and the first escape hex value has an x in it (why?). Anyways, when running them in Java as strings you need to escape the escape character (duh right?) with an extra '\' so, for example, the code might look like:
System.out.println("\\\x1B [A");
I just noticed that stack overflow escapes these too so I
actually have three '\' but for you guys, it only displays two '\',
weird right? Anyways back to what I was saying
BUT STILL, the output doesn't actually work! This is where I'm at. I've done the above and I 99.9% know git bash is installed right and runs fine but when I run this:
public class ExpressionEvaluator {
public static void main(String[] args) {
System.out.println("1");
System.out.println("\\x1B [A");
System.out.println("2");
}
}
I get this in java console (not git bash??):
1
\x1B [A
2
and this in git bash:
1
\x1B [A
2
What I actually want is:
2
1
Because the ANSI escape character is supposed to move my cursor/linefeed/whatever, one line upwards. The same thing happens if I run the above code but instead use the ANSI code: "\x1B [F". Only raw ANSI is output. I'm pretty sure git bash was supposed to be 'natively ANSI aware' and I've seen people say that on websites so I don't know why it isn't working.
And I still don't know for sure if those are two separate console outputs or the same console output. I really can't tell so if anyone wants to leave a comment saying 'yeah its the same dummy', I'd appreciate it because I can't find a definitive source out on the web that it is. I think it is but nothing other than the console setting in IntelliJ indicates that as true.
I've heard rumors of a TERM variable that needs to be set or otherwise manipulated on windows. I've checked myself what it is using:
echo $TERM
in git bash and I got back:
cygwin
So I don't exactly know if that's good or bad because I've literally gone through all the search terms you can think of and they all lead to the same basic page of results for 'git bash colors not working' and most of them involve windows 7 (don't have it) installing maven/jansi (don't want or shouldn't need it) or some other language that isn't Java and using some other IDE which isn't IntelliJ. Some pages that do have my specific requirements have said something about TERM supposed to be xterm or some other thing like xterm-256 or something for 'color' output, something like this. I am so unfamiliar with this stuff so I don't even know where to begin.
Too long give us a tl;dr
I need to know why git bash is printing raw ANSI instead of actually using the ANSI.
what I know
I'm using git bash with IntelliJ, 99.9% sure I have my path set correctly, I am able to run my java class from git bash, I have it set as the IntelliJ terminal and I currently have the windows TERM variable set to cygwin.
What I don't know
I don't know what TERM needs to be and can't find it on the web, I can't tell if the IntelliJ console that appears when I click the green arrow 'run' is the same as the git bash console, and I can't figure out if some other thing is preventing me from actually interpreting the ANSI.
What I need
I need a simple explanation, something straight out of r/ELI5 of what is wrong with git bash if anything and how to fix it. If it can't be explained simply or nothing is wrong then maybe I'll try another supposedly 'natively ANSI aware' terminal. I think Powershell was another option that was listed. My best bet is that the TERM variable needs to be something else, or git bash was never really natively ANSI aware and capable, to begin with. I've seen other questions with the same problem for colors but their fixes are for older versions/different languages and things or they don't actually work. I have yet to find a good page for 'git bash outputs raw ANSI in IntelliJ' and I've used variations of those exact words for hours now. All I can get is long GitHub discussions on the 'bugs' related to this and they confuse me, don't lead to solutions, and may be active or just don't contain any resolution.
Edit 2
After doing some more research I've learned that my previous escape code was correct:
\033[A
\x1B[A
should be similar.
I also learned that it isn't the console I'm using that's the problem, its Windows itself. I now know this because I've tried compiling and running on cmd.exe , git bash and powershell. To change the default setting talked about earlier (consoles not supporting ansi for child applications) you have to EXPLICITLY enable it via the program itself rather than rely on a console or something.
link to a question that explains this in Python here:
How to use the new support for ANSI escape sequences in the Windows 10 console?
tl;dr
The method that they use is something called getConsoleMode and setConsoleMode and VIRTUALTERMINALPROCESSING flags. Apparently you need to use these to actually set the console mode to support ANSI. I don't currently know if those are things that are in java hidden somewhere or (likely) something that needs to be added to the base java libraries. I'm going to try and figure out how they actually get the ctypes thing from that question (seems to be what they're importing to sue these methods) and get the methods I need. Once I do I'll post that as an answer unless one of you figures it out before I do and can explain it better.
Apparently, the escape sequences work fine if you only use them from the console but If you use a "child application" then they don't work. So at the very least we now for sure know the root cause of the problem.
Edit 3
Found this which is highly relevant especially the console virtual terminal sequences section (lefthand navbar):
https://learn.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences
This which, near the bottom has a whole C-implementation of how to enable the console to read ANSI. Apparently, this doesn't need libraries at all but the process to actually change the console defaults to use code like this requires sysadmin privileges, intimate knowledge of the program files and a whole host of other things (at least if you're before the windows 10 update when color support was changed). Now it's still disabled by default but can be enabled. I don't yet know how to try ANSI from the console directly. I've tried multiple
echo \x1B[(insert ANSI code here)
but none of the commands seem to work in ANY terminal (cmd, git bash, powershell). They just return the raw code
\x1B[(whatever the ANSI code was)
I obviously am new to the console so I might be using the wrong command, if so feel free to enlighten me but the examples I've seen use echo. ANYWAYS, I thought that calling the ANSI directly from terminal was supposed to work since its supposedly enabled by default just not child applications (post windows 10 update) BUT maybe its not, maybe its disabled by default and even when enabled its still disabled for child applications (Java) unless explicitly changed in said child application (java). I'm going to try to see if it's possible to enable ANSI directly from the console, or if the linked C-code needs to be directly ported to Java or ran in the console just to work. The problem is I don't know how to get the imports/includes that the C-code uses and use it for code in java. I'd rather not just accept a coded 'solution' in C and try and use that alongside java code, I'd rather translate, understand it better and have my own code that does the same thing.
Another option I've been told is something called ANSICON which is like some sort of plugin that you install in the console with the -i flag and that's supposed to enable ANSI at least in-console. I found this
https://community.liferay.com/blogs/-/blogs/enable-ansi-colors-in-windows-command-prompt
the above explains that process in a little more detail.
My specific windows version and the version of the update
Another thing I learned was that the specific version of windows 10 that the 'update' that changed ANSI console behavior was like windows 10 v1151 or something, I'll try and find the webpage to source this directly but I currently have windows 10 v1607 so I think I should be good. Included in that was the actual OS build which I have 14393.2035 and I think that was identified as a particularly intermediate update to this process in one of my previous links (I believe its the one with the whole GitHub discussion about the update, you can find it here: https://github.com/Microsoft/WSL/issues/1173). I have a work computer so I can't really make system updates because I'm not an administrator and I doubt IT would let an intern go around updating work computers.
Anyways, I'll continue on trying to see if I can get the C-code to java, I'll test it and then try and post an answer. If ya'll are ahead of me let me know.
The python way you reference in "Edit 2" (https://stackoverflow.com/a/36760881/309816) simply invokes Windows-specific native code (kernel32, which is non-portable) to "fix" this.
I suppose you are OK with that and want to do the same in Java (i.e. invoke kernel32 when you detect Windows)...
A very lightweight library for achieving the same in Java is JNA which has out-of-the-box wrapper for kernel32 (see: https://java-native-access.github.io/jna/4.2.1/com/sun/jna/platform/win32/Kernel32.html)
You seem to be after this method: https://java-native-access.github.io/jna/4.2.1/com/sun/jna/platform/win32/Wincon.html#SetConsoleMode-com.sun.jna.platform.win32.WinNT.HANDLE-int-
Hope this works for you.
EDIT: technically, you only need jna.jar (see getting started here: https://github.com/java-native-access/jna/blob/master/www/GettingStarted.md), but I would suggest you also use jna-platform.jar so that you don't need write the code that generates the mappings for kernel32 at runtime yourself.
Home for JNA: https://github.com/java-native-access/jna
I think adding 1 (or 2 if you add jna-platform) jars that have a very specific scope (doing native calls without all the JNI preparation overhead) is lightweight enough. You don't need to generate any headers, or change anything in your compilation process. It will just work by adding those jars to your classpath.
You should also clarify in your question that this is about Windows. Maybe edit the title to: "Printing up a line in java console (reverse of '\n') on Windows" as this is really about a platform-specific concern that you want to address with Java.

Can't edit java code-file is somehow empty

Hopefully this has a trivial answer: I have a java file which I wrote and edited a while back, but at some point I tried to open it recently and it says it is 0kb and no code is displayed in the IDE(i tried more than one). What is really confusing is that it runs perfectly from command line. It was just quite a small GuiApp, and all the class files are still there. Any help would be appreciated
You can decompile the .class file and you will see your code.
Fair warning, this will be 'compiled code' so expect to see many changes in your code as the compiler has the liberty to optimise code where it sees fit. You may see it use the StringBuilder class for example where you simply concated a couple of strings, etc.

How to get a list of the lines of code run during an execution?

I've tried to search for this topic but I haven't found what I'm looking for, it could be that my terminology is off however. I'm writing Java and coding in Eclipse Luna.
I currently have a program, and a set of tests related to that program that will produce a pass/fail result for each. What I'm looking for is the ability to run one of these tests and retrieve a list of the lines of code (both in the test file and the actual program) that has been executed at some point during the test. What methods can be used to accomplish this? The idea is to use that list later for fault localization if a test failed.

Debugging using Java source code

Is there a way to include whole Java source code into an eclipse project so the program is easier to debbug (e.g. by inserting println in methods you otherwise couldn't insert anything)?
I have a bug in my code. But to better understand why the bug in my code appears, I'd like to see what intermediate results in some system method (on which use the bug occurs) are.
For example, I'd like to know what JViewPort.scrollRectToVisible() exactly does and how my input behaves in it by printing out some intermediate results that occur in the method itself.
EDIT:
Instead of using JRE System Library X, I want to add the source code from JDK as if I had written the code myself. I want to be able to edit any System class just as I am able to edit any class I created myself. I want editable .java files, not packed .jars...
You would need to add the 3rd-party library to your Eclipse workspace as an project. (How you would do that depends on the code you are dealing with.) Once you have done that, you can hack your copy of the library to add trace prints etcetera.
A better alternative is to simply attach the source code for the 3rd-party library so that the debugger can show you source as you step through the code, set breakpoints,. Then use "advanced breakpoint" techniques instead of trace prints; e.g. http://www.vogella.com/articles/EclipseDebugging/article.html#advanced
You cannot change the library code, but you can view it by using de-compiler. The max you can do is this. Now if you change any code in the libraries which you reached via the de-compiler, you would find an error stating "the integrity of the .jar package has changed which is not allowed"
Eclipse have built-in support for what you wanna do.
All you have to do is set breakpoint and execute application in debugging mode.
You can use these icons in Eclipse debugging perspective.
Follow along Eclipse Debugging Tutorial for details.

Word Wrap in Net Beans

Netbeans is great but there's no way to wrap text in it (or hopefully I haven't found it yet). Is there any way to do this, and if not, is there any similarly good IDE for Java with this functionality (hopefully free as well).
You can use word wrap in Netbeans.
Add the following to netbeans.conf (netbeans_installation_path/etc/netbeans.conf, by default /etc/netbeans.conf under linux):
-J-Dorg.netbeans.editor.linewrap=true
to the sixth line so it looks like this:
netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-XX:PermSize=32m -J-XX:MaxPermSize=200m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dorg.netbeans.editor.linewrap=true"
and restart Netbeans.
Set the Line Wrap option in Tools->Options->Editor->Formating.
Works fine for me in Netbeans 6.9 and 7
If you do web development you are going to understand why text wrapping is important.
A programmer who has never gotten their hands dirty with HTML has never seen the real web. You can insist on MVC all you want to but 99.9% of the world wide web since its inception wasn't built that way. Unless you're always developing from a clean slate and can use MVC to separate the HTML out AND assuming you have an on-staff web designer who does html/css/javascript or you have an interface developer who you can fob it off on you WILL have to deal with everything that has been developed/kludged/hacked together with what ever technologies were at hand or popular or affordable at the time and now more or less functions as a 'web application'. And 99.9% of the time what you will have to work with is a mix of some kind of a programming language, most likely an interpreted one, with html and javascript all mixed in the same page.
And this means no nice short lines of neat clean java code that oh so conveniently end before 80 characters.
And when you deal with this -- which, dear hearts, is most of the web -- you magically discover the crying need for text wrapping to keep the long lines from making you scroll waaaay to the right to get to the end of it.
Some people. Sheesh. They think the whole universe of development has always fit on 80 characters per line, and from some of these comments, they seem to think it always will.
Netbeans 7 is out and it supports word wrap out of the box!
There's word-wrap eclipse plugin: see http://ahtik.com/blog/eclipse-word-wrap/
Like Joseph said: why would you need this. Java is not white space sensitive and having very long statements does not make your code easy to read.
It always goes back to Ultraedit.
Why can't we as a human race figure this out? netbeans, eclipse, zend studio (eclipse), etc don't do something very simple for programming, that most programmers -need to have- to keep a sound coding convention. Sure, it's true that coding style contributes to length of lines (erm microsoft programmers, perk your ears), but sometimes one cannot avoid long string literals. This is insanity! And yet I can't be mad or ungrateful because it's open source. And i -am- grateful. Still, one has to wonder wtf programmers who make these editors are actually using themselves.
I want an editor to wrap at column 80 or 120, not at the window's edge like notepad++. The only tool I've found that does hard/soft wrapping is ultraedit, so maybe I should try to see if I can get it to run under wine, since UE is the only 'real' editor that does it's job other than something weird / ugly / takes forever to learn and configure like emacs. And I am not going down that road- it gives me migranes to look at it because it's 2009 and we have cleartext and guis.
Is it really that difficult a problem to solve? If you draw a line down from column x and your word crosses over it, then put the beginning of the word under the indention of the line from which it started and mark the spill over row as a wrap row. Done.
Actually i heard netbeans is going to add word wrap feature in 6.7 release but then they decided to include this feature in 7.0 . hopefully we would see word wrap in the next release, according to few developers this isn't a necessary feature but for web developers this is totally needed.
There is a great solution to this at this website blog.robbychen.com
The jist is to add the following line inside the quotes for netbeans_default_options inside the config file then restart netbeans:
-J-Dorg.netbeans.editor.linewrap=true
Except Eclipse does not support word wrap either, and they even don't have set up a target for this. Just like Netbeans, this has been asked by many users, but was never included. It appears it requires much change, and as well does not seem to be a high priority for devs.
There was once a beginning of a plugin trying to word wrap in a limited way, but of course it does not work on recent versions.
When you get to where you want the line to end, just start a new line without ending the statement. It may underline it in red until you end the statement, but it won't cause any exceptions.
I find that it is also a good way to organize long println() statements.
Komodo Edit. In addition to its many other marvelous features, it actually wraps lines.
2 points:
Just found that wrapping is really needed if one wants to look into those damn SVG sources auto-generated when putting components from SVG palette...
I'm going to solve my current problem with seeing full SVG source by copy-paste to jEdit which is as configurable as Ultraedit (in the aspect of wrapping) and FoC!
As many have already noted, the answer is "you can't." As someone who uses Visual Studio and Eclipse-based products every day, when I am using Eclipse, I am constantly missing Visual Studio's line wrapping features, which I can turn on and off with a keystroke.
To the many people who have responded "you don't need this," stop being so condescending. Simply because you don't need a feature doesn't mean nobody else in the world does. Even if one were to religiously follow the advice "never have a line over 80 characters," you're going to need to edit code that others have composed and goes over 80 chars. And especially in the web-world, lines can get tremendously long. It's inevitable that you'll spend a lot of time looking at other people's code that goes way over 80 chars.
jEdit's line wrapping is very good. It preserves indentation and can be turned on an off very quickly. If I'm dealing with some very unwieldy long lines, I sometimes copy/paste in jEdit (which offers syntax highlighting for a myriad of languages) and use the line wrapping available there.
The new version of Netbeans supports it. See this post for instructions:
Word Wrap in Netbeans
Of course word wrap is useful for coders - what about when you're writing README.txt files and you have to stick to coding standards like http://drupal.org/node/161085 where is says there needs to be an 80 character word wrap.
In netbeans 7.3 you go to tools->options->editor->formatting, in the left menu area select the bottom most drop down that says line wrap, select your preference...done
Get a bigger monitor.
At 1920 x 1080 you don't need no steenkin word-wrap.
Update:
Wow, still getting downvotes. Maybe it's just how I said it. At least it hasn't caught up to the Eclipse answer yet.
I really thought this was a legitimate suggestion. I never thought that having a bigger monitor would make as much of a difference to coding as it has for me. If you're using a small monitor to code please consider getting a nice big new one. It does eliminate the need for word wrap in a lot of cases.

Categories