|
|
(2 intermediate revisions by one other user not shown) |
Line 1: |
Line 1: |
| [[Category:Language]]{{NoTitle}} | | #REDIRECT [[Language - Java]] |
| {|
| |
| |style="vertical-align:middle; width: 60%;"|
| |
| <font size=6>'''Language - Java'''
| |
| | |
| '''Windows with Eclipse'''</font>
| |
| | |
| Welcome to using Phidgets with Java! By using Java, you will have access to the complete Phidget22 API, including events.
| |
| | |
| Eclipse is an IDE used to write, compile, and run Java applications.
| |
| |{{TOC limit|2}}
| |
| |}
| |
| | |
| {{Language_-_Java_Intro|Windows|Eclipse}}
| |
| | |
| {{Finding Code Samples|Java}}
| |
| | |
| ==Setting up a New Project==
| |
| When you are building a project from scratch, or adding Phidget functionality to an existing project, you'll need to configure your development environment to properly link the Phidget Java library.
| |
| | |
| To begin, create a new Java project. Give it a name, then click ''Next >'':
| |
| [[Image:Java_eclipse_newproject.PNG|link=| center]]
| |
| | |
| | |
| Go to the ''Libraries'' tab and click ''Add External JARs...'' and add phidget22.jar to your project as an external jar:
| |
| [[Image:Java_eclipse_addjar.png|link=| center]]
| |
| | |
| | |
| Create a new Class in your project:
| |
| [[Image:Java_eclipse_newClass_menu.png|link=|center]]
| |
| | |
| | |
| Name the class, and be sure to check the ''public static void main'' box.
| |
| [[Image:Java_eclipse_newClass.png|link=|center]]
| |
| | |
| | |
| The project now has access to Phidgets.
| |
| | |
| ==Using the Code Samples==
| |
| Now that you have configured a project to use Phidgets, you can copy the code sample for your device from the [{{server}}/?view=code_samples&lang=Java Code Samples] page into your project. Be sure to change the name of the top class to match the name of the file in your project.
| |
| | |
| [[Image:Java_Sample_Code_Windows_Eclipse.png|link=|center|850px]]
| |
| | |
| {{Language Page What's Next}}
| |