|
|
(One intermediate revision 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'''
| |
| | |
| '''Linux with NetBeans'''</font>
| |
| | |
| Welcome to using Phidgets with Java! By using Java, you will have access to the complete Phidget22 API, including events.
| |
| | |
| NetBeans is an IDE used to write, compile, and run Java applications.
| |
| |{{TOC limit|2}}
| |
| |}
| |
| | |
| {{Language_-_Java_Intro|Linux|NetBeans}}
| |
| #You will need a copy of [{{SERVER}}/downloads/phidget22/libraries/any/Phidget22Java.zip phidget22.jar]
| |
| | |
| ==Use Our Examples==
| |
| One of the best ways to start programming with Phidgets is to use our example code as a guide. In order to run the examples, you will need to download and install [https://netbeans.org/ NetBeans].
| |
| | |
| Now that you have NetBeans installed, select an example that will work with your Phidget:
| |
| *{{SampleCode|Java|Java Examples}}
| |
| | |
| | |
| Next, open NetBeans and create a new project. Select ''Java Application'' then click ''Next >'':
| |
| [[Image:Java_netbeans_linux_newproject.PNG|link=|center]]
| |
| | |
| | |
| Give your project a name and finish creating the project:
| |
| [[Image:Java_netbeans_linux_nameproject.PNG|link= |center]]
| |
| | |
| | |
| Delete the java file that was generated with the project:
| |
| [[Image:Java_netbeans_linux_delete.png|link= |center|850px]]
| |
| | |
| | |
| Replace the deleted file with the example file that you downloaded. Next, add a reference to phidget22.jar by right-clicking on the libraries folder:
| |
| [[Image:Java_netbeans_linux_addjar.png|link= |center|850px]]
| |
| | |
| | |
| [[Image:Java_netbeans_linux_jarpath.png|link=|center]]
| |
| | |
| | |
| Before you run the example, you may need to set up your Udev rules. An explanation on how to do this is provided on the Linux OS page, which can be accessed [[OS - Linux#Setting udev Rules | here]].
| |
| | |
| | |
| {{Edit_the_Examples}}
| |
| | |
| ==Editing the Examples==
| |
| {{Language_-_Java_Editing_the_Examples}}
| |
| | |
| ==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 start, open NetBeans and create a new project. Select ''Java Application'' then click ''Next >'':
| |
| [[Image:Java_netbeans_linux_newproject.PNG|link=|center]]
| |
| | |
| | |
| Give your project a name and finish creating the project:
| |
| [[Image:Java_netbeans_linux_nameproject.PNG|link= |center]]
| |
| | |
| | |
| Next, add a reference to phidget22.jar by right-clicking on the libraries folder:
| |
| [[Image:Java_netbeans_new_project_addjar.png|link= |center | 850px]]
| |
| | |
| | |
| [[Image:Java_netbeans_linux_jarpath.png|link=|center]]
| |
| | |
| | |
| The project now has access to Phidgets.
| |
| | |
| {{Language Page What's Next}}
| |