Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

20 October 2010

Importing GWT SDK Samples into Eclipse

I've recently started working with the Google Web Toolkit (GWT), which seems pretty sweet from everything I've read so far. It has great integration with an IDE, in this case Eclipse, which is absolutely essential.

Unfortunately, it was hard to find a way to easily open GWT's sample projects in Eclipse, but after a little trial and error, here is what I came up with. For each sample project you want to use, do the following:
  1. Create a new Java project with the name of the sample project you want to use, for example, "Hello". Use all the other default settings, and press "Finish".
  2. Right-click on the project and choose "Import". Choose "General" -> "File System", then press "Next".
  3. Browse to the directory of the sample project you want to import. On my computer, the project was found at something like: C:\Program Files\eclipse\plugins\com.google.gwt.eclipse.sdkbundle...\gwt-2.0.4\samples. Select all, then press "Finish".
  4. Right-click on the project and choose "Google" -> "Web Toolkit Settings". Check the "Use Google Web Toolkit" check box.
  5. Go the the "Java Build Path" section of the project's properties. Change the default output folder to something like: "/Hello/war/WEB-INF/classes" (This will be different depending on your project name).
That's all! Good luck and have fun trying out GWT's samples.

20 October 2008

JUnit Testing Scala in Eclipse

Being a fairly new convert to agile development methods, including test driven development, I knew the first thing I would want to get up and running with Scala was a unit testing framework. The NetBeans plugin has built-in JUnit support which served me very well. But I also wanted to get some unit testing working with the Eclipse plugin. It took me a while to get JUnit testing setup with Eclipse, mainly due to my lack of experience in the Java ecosystem. To help future explorers down this path, here are a few lessons I learned.

Put the your tests in a separate source folder. See this tutorial on setting up JUnit in Eclipse for more information.

Add JUnit to your project's build path. Select the project and choose "Build Path" -> "Add Libraries...". Then choose the JUnit jar.

Add the output directory of your project to your build path. See this short guide from the makers of Spec.

To get you started, here is a simple test:
package tests

import junit.framework._
import org.junit.Assert._

class FirstTest extends TestCase {
override def setUp() = {
}

override def tearDown() = {
}

def testOne() = {
assertEquals(1, 1)
}
}

03 October 2008

Scala's Community

I am studying the functional/object-oriented language Scala right now and I thought I'd share a few observations about this language and the community around it:

Last night I was having some issues getting Eclipse's Scala plugin to work correctly. Frustrated, I went on Scala's IRC chat room and made an off-hand comment on my problems. The maintainer of the plugin just happened to be in the room at the time, and pointed out my problem, quickly setting me on the right path. My first "technical support" question solved!

A great little tutorial for getting someone familiar with Scala from the Java/C# school of object-oriented programming is Daniel Spiewak's Scala for Java Refugees. Highly recommended.