This is a collection of various tips and things I use in Java. This is actually up on the web more as a refrence to myself than anything else. I keep learning this stuff, but since I dont use it all that frequently I tend to forget how to do something exactly the next time i need to. So here are little commands I use and some tiny descriptions. If you have some tips tricks or think i am doing something the hard way please feel free to comment and share. If you have any Java questions please feel free to post them if you think it is something I might be able to help you with. That said here is some java stuff… First off i think the best way to work with java code and projects is using J Builder. It is available free for personal use. I highly recommend it. It is available for linux and windows. get it from Borland If your going to develop web applications I also highly recommend apache tomcat. It is a free java (JSP) server. It is also available for both windows and linux which is great. get it from Apache Tomcat If a java program keeps running out of memory, this is easy to fix. The java virtual machine is only given so much memory. So running:”java -Xmx256m PROGRAMNAME” should fix the problem by giving the virtual machine 256 mb of memory. You will see this error as a java.lang.outofmemory error. If your using J builder go to project->run->Java VM parameters: and add the -Xmx256m to the parameter line. Here’s how you could rewrite that statement using the ?: operator: System.out.println(“The character “ + aChar + “ is “ + (Character.isUpperCase(aChar) ? “upper” : “lower”) + “case.”); The ?: operator returns the string “upper” if the isUpperCase method returns true. Otherwise, it returns the string “lower”. The result is concatenated with other parts of a message to be displayed. Using ?: makes sense here because the if statement is secondary to the call to the println method. Once you get used to this construct, it also makes the code easier to read. Files:One of the first Java projects I did the source and some info on a AOL Instant messenger (AIM) chatterbot. Built using simpleaim, megahal and some of my own work. Most of the work was in combining the programs learning how they worked and such though. I did add a nice logger to it as well. This still needs alot of work to be that impressive. download A part of my machine learning, for project News Shaker. Text2SVM converts text documents into the proper format for use with SVMlight. It is fairly well commented and contains the full source code. This is a good easy way to learn to work with reading and writting files since it has alot of IO. Visit this projects own page, Text2SVM. My edited and improved version of weblech. Weblech is a web spider. I added many features and costumized it for my own purposes. This crawler uses google to find files that are relavant to whatever topics your working on. Download the improved weblech from here Links:A great starting point for building a java web spider (Weblech) My edited and improved version of weblech A great Java Word Counter / dictionary builder Stop List Parsing Text Java MySQL tutorial Java Porter Stemming Algorythm Java Lancaster Stemmer Sorting a hash table in java Java sort class (sorts most types) a great java machine learning site Pretty much everything you would need to work with java Email How to work with multipart email messages Great Java Swing Tutorials, especially the stuff on the grid bag layout Great webservices and java XML info The 10 best and unervalued least known about java libraries. some of these would be great to use in many projects without reimplementing there feautres yourself.

blog comments powered by Disqus
Dan Mayer Profile Pic

I primary write about Ruby development, distributed teams, & dev/PM process. The archives go back to my first CS classes during college when I was learning to write software. I contribute to a few OSS projects and often work on my own projects. You can find my code on github.

Twitter @danmayer

Github @danmayer