Results 1 to 5 of 5
Thread: Netbeans API Tutorials...
- 01-31-2012, 11:05 PM #1
Netbeans API Tutorials...
After agreeing with Fubarable that using a database was better than what I questioned, I have started to dig deeper into the depths of the Netbeans IDE. I have upgraded from Netbeans 7.0.1 to Netbeans 7.1. I was directed to a tutorial page that teaches us about Netbeans APIs before learning about CRUD. I want to build a database on the Netbeans platform. I did the first tutorial, but I am having a problem with the second. Part 2: Lookup API. In the tutorial the instructor added the import (import org.demo.service.ServiceInterface;) to the second application. When I try to add the import Netbeans informs me that org.demo.service does not exist. The editor will only allow me to add the import (import org.demo.ServiceInterface;). Then when I do the editor gives a warning with two options. When I select either option the editor deletes the import. So, in a nutshell the program compiles and runs, but it does not return anything. Heres the link to the tutorial page. The tutorial is as stated before: Part 2: Lookup API. NetBeans Top 10 NetBeans APIs
If someone would, could you watch the demo and see if you can make it work. I can only think that the installation of Netbeans or Java 1.6 on my computer is missing something. I don't really know. I thought that one of you experts on this site could help me out.
Thanks in Advance,
switchLast edited by switch; 01-31-2012 at 11:07 PM.
- 02-01-2012, 09:26 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: Netbeans API Tutorials...
Show us the code and tell us what the error Netbeans is giving you.
I doubt many people will want to watch the vid.
- 02-01-2012, 07:52 PM #3
Re: Netbeans API Tutorials...

First Application:
Second Application:Java Code:package org.demo; /** * * @author switch */ public interface ServiceInterface { public String getName(); }
Third Application:Java Code:package org.demo; //import org.demo.service.ServiceInterface; (the instructor used this import here) //(netbeans won't allow me to use this import or import org.demo.ServiceInterface; without an error or warning) /** * * @author switch */ public class ServiceProvider1 implements ServiceInterface { @Override public String getName() { return "switch"; } }
Empty file (org.demo.ServiceInterface):Java Code:package thirdappserviceproviderdisplayer; import java.util.ServiceLoader; import org.demo.ServiceInterface; //(Netbeans accepts this but when I use .service, net beans says that org.demo.service doe's not exists. //(Why was the instructor able to do this and I can't?) //import org.demo.service.ServiceInterface; (The instructor used this import here) /** * * @author switch */ public class ThirdAppServiceProviderDisplayer { /** * @param args the command line arguments */ public static void main(String[] args) { for (ServiceInterface sInterface : ServiceLoader.load(ServiceInterface.class)) { System.out.println("Hello " + sInterface); } } }
The return value should be "Hello switch." I don't get any return value. I can't use the import that the instructor used.Java Code:org.demo.ServiceProvider1
Thanks Tolls...Last edited by switch; 02-01-2012 at 08:00 PM.
- 02-02-2012, 09:40 AM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Re: Netbeans API Tutorials...
Either you've put the ServiceInterface in the wrong package in the first app, or the tutorial is wrong (which happens quite a lot, even with well-reviewed stuff).
Essentially if FirstApp is correct, based on the earlier steps, then the later bits of the tutorial are mistaken with respect to the location of that interface.
So I wouldn't worry about the import statement.
As for why it isn't prinitn switch, you haven't called the getName method.
You are just relying on the base toString() method for printing out ServiceProvider1, that is the toString() that is in Object.
- 02-02-2012, 09:40 AM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Similar Threads
-
What tutorials to use?
By Eleeist in forum New To JavaReplies: 6Last Post: 08-02-2011, 03:21 PM -
Anyone Looking tutorials or help with java?
By TheITRanger in forum Java SoftwareReplies: 0Last Post: 02-24-2011, 08:25 PM -
looking for tutorials
By bap2 in forum New To JavaReplies: 0Last Post: 12-02-2010, 08:40 PM -
MDB tutorials
By asliyanage in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 03-06-2010, 01:23 PM -
My tutorials
By gibsonrocker800 in forum Forum LobbyReplies: 2Last Post: 01-06-2008, 07:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks