Fear and Loathing on the Learning Curve: Observations on Life, Tech and Web Design from a Slightly Misanthropic Mind

Java Niggles

Spent this after­noon get­ting to grips with Java, which I haven’t touched for a long time. Many moons ago I did attempt to learn some, but the book I bought was ass, so I stopped. While work­ing with it today I had to find out a couple of things which I thought I’d share. This is basic stuff, but I didn’t know it until 2 hours ago, and it wasn’t easy to find out then.

I’m using the J2SE Dev Kit 5.0 Update 5 on Windows XP.

Environment Variables
Before any Java apps you’ve writ­ten will com­pile, you’ll have to set your CLASSPATH envir­on­ment vari­able cor­rectly. From Sun’s page I found the com­mand (which, believe it or not, I’d never come across before in Windows), and I used the fol­low­ing to cover all my bases:
> set CLASSPATH=C:\Program Files\Java\jdk1.5.0_05\lib;C:\Program Files\Java\jdk1.5.0_05\bin;C:\Program Files\Java\jdk1.5.0_05\;C:\Program Files\Java\jdk1.5.0_05\include
If this isn’t set up right, you’ll get error mes­sages about java.lang.NoClassDefFoundError.

Using Custom Libraries
As part of my course I get to use an IO lib­rary provided by Warwick to assist with us new­bies’ IO, the uk.ac.warwick.dcs.util.io pack­age. I couldn’t fig­ure out why javac was com­plain­ing about not being able to find the pack­age, until I found out that I had to include a ref­er­ence to the file in my CLASSPATH, adding C:\Program Files\Java\jdk1.5.0_05\lib\uk.ac.warwick.dcs.util.io.jar to the com­mand above.

There, wasn’t that helpful? :-) B

   

Comment

You can also Register for more profile options.

There are no comments yet — why not start the discussion?