I’m going to be providing source code for you all to look at and pick apart as a demo, but I’m going to explain a few things first. This is commonly bad practice when making an actual application, but we’re doing experiments, not making the next Word Processor or Internet Browser. Create a new java class in the Default Package.
For our purposes, only worry about the weka.jar. That is all the human readable source that, when compiled, becomes the Weka program you used in Homework 1. If you’re feeling adventurous, at another time, you can extract files from that JAR with WinRAR or similar archiving tools. You may notice that there’s a weka -src.jar file, as well. Navigate to the Weka folder in the file dialog and select the weka.jar file. They’re actually what we’re going to be using to expose the Weka API to Netbeans so that you can program in Java with the same flexibility as the Weka GUI, and possibly more. If you’ve navigated the Weka program folder, you’ll notice something called JAR files. You should should be back back at the the main IDE window. packages.Īt this point, point, click Finish. T hat option will just give you you more headaches headaches later on ifif you’re not familiar with java packages. On the next screen, give the project a name and uncheck “Create Main Class”. We’re going to be creating this project as a new application. Once Netbeans is installed, run the IDE and create a new project.
Try Scribd FREE for 30 days to access over 125 million titles without ads or interruptions! Start Free Trial Cancel Anytime. You won’t nee d either of them to use Netbeans. Follow the installer and avoid installing the Ask! Toolbar or McAfee in the event that they are offered by the installer. Machines in the Unix Lab and Web Lab should have NetBeans installed already. After which, you should choose the package that corresponds with the ma chine you’re going to be using the IDE on.
You need to accept the license agreement (unless you disagree with the licensing terms). The process is like with Unix/Linux systems, but since the host system is Win32 and therefore the Java installation also a Windows application, you'll have to use the semicolon as separator for several jars.Netbeans IDE Tutorial for using u sing the Weka API Kevin Amaral University of Massachusetts Boston First, download Netbeans packaged with the JDK from Oracle. Note: the prefixing with $CLASSPATH adds the mysql jar at the end of the currently existing CLASSPATH. Unix/Linux uses the colon : as path separator, in contrast to Windows, which uses the semicolon. Setenv CLASSPATH $CLASSPATH:/home/johndoe/jars/mysql-connector-java-5.1.6-bin.jar Open a shell and execute the following command, depending on the shell you're using:Įxport CLASSPATH=$CLASSPATH:/home/johndoe/jars/mysql-connector-java-5.1.6-bin.jar I assume, that the mysql jar is located in the following directory: /home/johndoe/jars/ If you want to add additional jars, you'll have to separate them with the path separator, the semicolon (no spaces!). Enter the following name for the variable CLASSPATHĪnd add this value C:\Program Files\Weka-3-8\mysql-connector-java-5.1.6-bin.jar There you will find a button called Environment Variables, click it.ĭepending on, whether you're the only person using this computer or it is a lab computer shared by many, you can either create a new system-wide (you are the only user) environment variable or a user dependent one (recommended for multi-user machines).
In the Control Panel click on System (or right click on This PC and select Properties) and then go to the Advanced tab.
We assume that the mysql-connector-java-5.1.6-bin.jar archive is located in the following directory: C:\Program Files\Weka-3-8 In the following we add the mysql-connector-java-5.1.6-bin.jar to our CLASSPATH variable (this works for any other jar archive) to make it possible to access MySQL Databases via JDBC. ANT offers a nice way for building (and separating source code and class files) Java projects.īut still, if you're only working on totally separate projects, it might be easiest for you to use the environment variable. The CLASSPATH would just mess up things, if you're not careful (or just forget to remove an entry).
I, personally, never use the environment variable, since I'm working often on a project in different versions in parallel. Since Java does the search in a ''first-come-first-serve'' kind of manner, you'll have to take care where and what to put in your CLASSPATH. The CLASSPATH environment variable tells Java where to look for classes.