Using libraries in NetBeans 6.1

Suppose you have two classes that are in separate files but the same package. In order for one class to access the other that it references that is in the same package, what do you need to do? What I did was add the project that contains the referenced class to the Libraries folder (listed under the Projects tab) that's inside the file in which its referenced. I don't understand why I needed to do this since both classes are in the same package (and in the same directory). I believe I created the project files correctly because for each file I selected New Project, then Class Library, and I clicked on the Source Packages tab under the Projects tab and added a new Java package...The code for the two classes are listed below (Note, I don't know if this would make a difference, but the IDE I used is NetBeans 6.1):
//: innerclasses/controller/Event.java
// The common methods for any control event.
package innerclasses.controller;
public abstract class Event {
  private long eventTime;
  protected final long delayTime;
  public Event(long delayTime) {
    this.delayTime = delayTime;
    start();
  public void start() { // Allows restarting
    eventTime = System.nanoTime() + delayTime;
  public boolean ready() {
    return System.nanoTime() >= eventTime;
  public abstract void action();
} ///:~
//: innerclasses/controller/Controller.java
// The reusable framework for control systems.
package innerclasses.controller;
import java.util.*;
public class Controller {
  // A class from java.util to hold Event objects:
  private List<Event> eventList = new ArrayList<Event>();
  public void addEvent(Event c) { eventList.add(c); }
  public void run() {
    while(eventList.size() > 0)
      // Make a copy so you're not modifying the list
      // while you're selecting the elements in it:
      for(Event e : new ArrayList<Event>(eventList))
        if(e.ready()) {
          System.out.println(e);
          e.action();
          eventList.remove(e);
} ///:~Similarly, how do you import the library innerclasses.controller other than writing "import innerclasses.controller;?" I did the same as listed above (adding the two project files above that are from the same package to the Libraries folder that's inside the file).
Thanks in advance!

hi it is unlikely people will answer you here because it is about netbeans. this is a java site so they will probably tell you to go to a netbeans site. the one i use is nabbles netbeans just do a search on google to find it.
you might get lucky here but i doubt it because most people here use notepad and run programs from command prompt. so they might not even know anyway. also i think there is a tutorial at the netbeans sites about transfering libraries they tell you how in some of the introductory tutorials. i think one of the tutorials in relation to setting up a database using derby shows you how to do it but i can't remember.
your best bet is nabble good luck.

Similar Messages

  • [Help] Compile and running a java which uses libraries in linux

    I have a java program which has all it's *.java files in the src directory. it uses libraries (e.g. activemq-core-5.1.0.1.jar and commons-logging.jar) stored in a folder called libs which is in the directory level as the src folder.
    how do i compile this program in linux and convert it to a jar file?
    once compiled how do i do run it? will simply running the jar file i just created be sufficient?

    I don't know what your application does but the basic way of compiling classes in Linux is
    javac -classpath    ALL_DEPENDENCY_LIBS    PATH_TO_SRC_FOLDERAnd in case of Linux the dependency files ought to be separated by : and not ;
    I would suggest you have a look at ant or maven for building your project,
    To start might be difficult, but it will surely payoff as you build large projects once you know how they work!

  • Using libraries vs. Bridge for graphics in placeholder frames

    Hi,
    I do not understand the advantanges of using libraries vs. Bridge for my purpose:
    Purpose:
    I am working with templates using graphic placeholder frames. The frames are anchored in table cells and have object styles applied defining e.g. the placement of the graphic within the graphic frame.
    I want to set up central graphic library for all graphics used in all my documents.
    The graphics should then be linked into the documents
    Idea:
    set up various InDesign libraries and then drag the graphics into the placeholder frames. Then, when the graphic needs to be changed, do the changes in the library and have all my documents updated at once.
    Problem:
    Dragging graphics from the library into the placeholder frames does not seem to work. They are simply placed onto the page and NOT in the graphic frame. On the other hand when I simply store the graphics in various subdirectories in my file system and drag the graphics onto the page using Adobe Bridge, they ARE placed in the graphic placeholder frames.
    The library therefore seems a disadvantage, so why should I use a library instead of the Bridge?
    Also, will be upgrading to CS5 soon an want to use the live-linking caption feature. Should I use libraries or the Bridge approach?
    Stumped on this issue

    I like the idea with the snippet, but when dragging a snippet from Bridge there is still the same problem as with the library item: The graphic is NOT placed into the graphic placeholder frame of my template but is a free-flowing new graphic item which has to be placed manually.
    Interestingly, a JPG-file simply saved in the filesystem and dragged from Bridge and dropped over the placeholder frame WILL place the JPG into the frame!
    Why won't snippets do this??

  • Error-- Referencing classes from project 1 in project 2 using libraries option

    Using JDev 9.0.3
    I'm struggling with an error that's occuring that I know should not be...
    I have two projects (SessionUtils & TradingSumStruts).
    SessionUtils has 4 java files all of which have a package name of: com.arca.sessionutils.
    TradingSumStruts has 3 java files all of which have a package name of: com.arca.tradingsum.
    One of the java files in TradingSumStruts imports a class from SessionUtils
    import com.arca.sessionutils.SessionUtil;
    In TradingSumStruts project I have created a new user library and called it: SessionUtilsLib. This lib points to the classes directory of SessionUtils, and the src directory of SessionUtils in the same workspace.
    I've shut down the oc4j server, deleted any existing class files for the above two projects, and recompiled both projects. When I run the app, I get the following error:
    java.lang.NoClassDefFoundError: com/arca/sessionutils/SessionUtil
         void com.arca.tradingsum.TradingSumInfo.<init>(javax.servlet.http.HttpServletRequest)
              TradingSumInfo.java:67
    when I attempt to call SessionUtil.xxxMethod().
    I have double and triple checked my spelling, my library entries, my class files, and even re-booted my machine.
    ANY ideas would be greatly appreciated!
    -Teri
    [email protected]

    Don't use libraries for this. Define a project dependency for your project using the project properties dialog. This will automatically include your project classes without hardcoding the path into a library.

  • IS IT POSSIBLE TO USE HIBERNATE WITH NETBEAN?

    Hi and Happy New year,
    Please, is it possible to use hibernate with netbean. If yes, where can I get the materials on the configuration.
    Thanks
    Emeka

    NetBeans is an IDE. Hibernate is a data access API/solution. So not sure what you're asking. If you want to know if NetBeans IDE has Hibernate integration, go look at NetBeans feature set and/or plugins. Either way, Google...

  • Feedback: Infering the user does not use Libraries

    Infering the user is not actually using Libraries in Windows 10 - greatly optimizing the experience of opening Explorer
    Feedback: If user does not have a collection of folders in any Library on install an algorithm in Windows 10 should automatically disable Libraries.
    In that case Explorer > Folder Options > General > Navigation Pane > Show libraries should be automatically set to off when creating the user profile for the Windows 10 user for the first time.

    I was facing the very same, when trying to sync my MS Project with SharePoint. On first sync between MSP and SP all the names I had assigned in the Project plan were not transferred to the SP list.
    I tried to enter the names manually in the SP list (Current View: "Project Task"), but always got the message "The User does not exist or is not unique. Permissions to the SP site are ok and I tried users from different domains, all the same result.
    When switching to the view "All Tasks" and edit the list item manually, it works w/o any issue. Not sure why, but at least a workaround for the 1st issue, even though one more step to add a user.
    Now I added a few names which were not in my MSP plan before and syncing back did not work. Reason here is the differences of Regional settings. On SP name fields do apear e.g. like this: "Klick, Heiko ; Simpson, Bart". In MSP "Heiko Klick, Bart Simpson".
    So in SP the field delimiter is ";" and per default in MSP ",". Once changing this in my local regional settings, the names are getting synced back.
    The way you setup resources in MSP is important. When picking names from the Outlook Adress book they occur as e.g. "Bart Simpson" and I can not sync between MSP and SP. When picking the names from Active Directory they get added as "Simpson, Bart"
    and everything works well.
    I hope this will help others with the same issue.

  • Use iText in NetBeans

    Hi,
    I'd like to make PDF file in my program, but I don't know how to use iText in NetBeans.
    I'm following this manual [https://nbitextsupport.dev.java.net/], but I don't know, how to get and install nbitextsupport module.
    I'm newbie, I'm doing this (adding .jar files and making modules) for the first time.
    Thx for help.
    Edited by: petanorech on Jun 19, 2008 9:33 AM

    petanorech wrote:
    Hi,
    I'd like to make PDF file in my program, but I don't know how to use iText in NetBeans.
    I'm following this manual [https://nbitextsupport.dev.java.net/], but I don't know, how to get and install nbitextsupport module.
    I don't know what that is.
    I'd recommend that you download iText from http://www.lowagie.com/iText/download.html.
    Take the iText JAR and any dependencies it has and put them in a directory near your project /src file. I'd recommend creating a folder like /lib and putting them there.
    Then add all those JARs to your NetBeans project CLASSPATH. I'm not sure how NetBeans does it, but if you were in Eclipse you'd right click on the project root, select something like "Properties", and add the JARs as instructed.
    Maybe you can look in the NetBeans help for some advice on how it wants you to do it. The NetBeans Help will be better than posting here. It'll be faster.
    %

  • Anyone knows about adding JTAPI libraries into netbeans 5?

    anyone knows how can i add JTAPI libraries into my project in netbeans?i can use the auto import in netbeans when i use import javax.telephony.*; with it's javadoc shown.but netbeans still issuing an error when i try to compile my file.any ideas?

    hi,
    thanks for replying.i have done that already,i think that's why i can use the auto complete feature and see those packages but the problem is netbeans can see those packages and still give me the message :
    package javax.telephony.*; does not exsist. even when i tryed to compile my file it showed the same message.
    any ideas?

  • Errors when using tomcat and netbeans combo.[Solved]

    Hi I'm trying to set up a netbeans/tomcat7 development environment for servlet development.
    I have tried this on 2 machines without any success.
    The steps I have followed are as follows.
    First I installed tomcat7 and netbeans from using pacman, then to be able to configure tomcat from netbeans I made the config files write permission 777, as it's just a development server security is not an issue.
    From there I started up netbeans started a new project and set the server to tomcat and pointed the Catalina home dir to /usr/share/tomcat7.
    When I try to run the example jsp project I get the following error:
    description The server encountered an internal error () that prevented it from fulfilling this request.
    exception
    org.apache.jasper.JasperException: java.lang.IllegalStateException: No Java compiler available
    org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:584)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:392)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    root cause
    java.lang.IllegalStateException: No Java compiler available
    org.apache.jasper.JspCompilationContext.createCompiler(JspCompilationContext.java:226)
    org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:636)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:389)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:333)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
    I've spent the last couple of days trying to find any information on this but I cant find anything, so any advice would be much appreciated.
    Last edited by darkclown (2011-12-01 05:15:23)

    From the error, it appears that there is no JDK installed - only a JRE, could that be the case? If you do have a JDK installed, then Tomcat is not finding it.
    I would also not run this on the openJDK, in case you are doing that. I would use the proprietary Oracle/Sun JDK. It's in the AUR, or simply download it from Oracle.
    I was not even aware that netbeans and tomcat are available from pacman. I always "install" those myself manually (i.e. unpack them into a folder). They are simply Java apps that can be installed anywhere, as long as you point them to a valid JDK.

  • Using libraries as part of a script to execut jre

    I am attempting to run a project that contains the commons-net-ftp-20.jar. I am able to execute the project successfully from netbeans. I am able to execute the project successfully by placing commons-net-ftp-20 in the ext library of the jre. When I attempt to run the project with the commons-net-ftp-20 in my pwd using the following script I get the error message:
    Exception in thread "AWT EventQueue-0" java .lang.NoClassFoundError: org/apache/commons/net/ftpConnectionClosedException
    My script which is run in windows is:
    SET CLASSPATH=.;F:\JavaApplication1.jar;F:\commons-net-ftp-20.jar
    .\jre1.6.0_07\bin\java.exe -jar JavaApplication1.jar
    JavaApplication1.jar, jre1.6.0_07, commons-net-ftp-20.jar are all in the same directory.
    How can I get the JavaApplication1 project to run.
    I would appreciate any ideas.
    Regards,
    Sandyg

    When you execute a jar (with option -jar) java.exe ignores the CLASSPATH environment variable. Instead it uses the Class-Path header field in the jar's manifest. All you need to do is to correct that entry:
    [http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html]

  • Using SwingConstants in NetBeans designer mode

    In NetBeans, when adding property get/set methods for a bean they'll be added automatically to the properties panel in the designer.
    I've written a setHorizontalAlignment method for a custom JComboBox I use and I want to use SwingConstants as the method parameter.
    How do I get the IDE to display my custom method like the standard setHorizontalAlignment method of JLabel / JTextField, that is as choice selection from a list of SwingConstants values.

    Problem was fixed by a upgrad of the JDK.

  • Problem for using query in netbeans

    hello friends,
    i created a database using mysql(5.0.33) in XAMPP. I am using netbeans5.5 and i got the connection to the database successfully and can query well using SQL command.
    the problem is that i can't use the query to insert the data from the databse to a combobox or textfield in the JFrame.
    plz explain how to apply queries in netbeans ???

    the problem is that i can't use the query to insert
    the data from the databse to a combobox or textfield
    in the JFrame.Are you reading the resultset?
    plz explain how to apply queries in netbeans ???What do you mean by applying queries in netbeans?

  • ADF Faces skins problems using libraries

    Hi,
    I have been trying to use the tutorial on the following website:
    http://www.oracle.com/technology/products/jdev/101/howtos/adfskins/index.html
    This shows you how to create skins and things. The only problem is that I cannot see the view that is shown in the screenshot. I.e. I get a load of garbled gabage showing me the tags in the document instead of whats visually there.
    I realise this is a problem with the library but everytime I try and set up the JSF and ADF libraries in the JSP Tag libraries of Tools->Manage Libraries I click the Execute Tags in JSP Visual Editor it lets me do it but then I click refresh on the window with sample.jspx in it and JDeveloper just dies.
    The libraries I am using I have downloaded and followed the instructions on
    http://www.oracle.com/technology/products/jdev/howtos/10g/jsf_howto/jsf.html
    To do the JSF libraries and I have followed the same instructions for the ADF libraries. If anyone has any idea I would be glad of the help
    Cheers
    Daniel

    I tried the same example and it is working fine with me. May I know the JDeveloper version you are using?

  • Preverification Error while using kXML with Netbeans IDE

    Hello All,
    I am using Netbeans IDE for wrting a program that parses a xml using
    kXML and display some results on screen.
    The Netbeans IDE gives the various obfuscation levels.
    The code is properly compiled at any level less than the
    highest obfuscation level. If I compile it at HIGH obfuscation level then it gives the following error-----
    Error preverifying class e
    VERIFIER ERROR e.a(Ll;)Lorg/kxml/kdom/Element;:
    Cannot find class org/kxml/kdom/Element
    D:\Netbeans_Workspace\TestObfuscation\nbproject\build-impl.xml:269: Preverification failed with error code 1.
    BUILD FAILED (total time: 4 seconds)
    How can we obfuscate the program using highest level of obfuscation.
    Thanks
    Vikas

    Thanks Peace,
    But I am facing the same problem even when I use the source java files of kXML and include those in my project and use them as additional classes to my class.
    It again builds properly when I don't use the highest obfuscation level.
    But if I try to obfuscate using Level HIGH it throws the same error.
    However when I try to run this project from J2ME Wireless Toolkit, it is running fine on the emulator.
    I guess the error is something specific to Netbeans IDE. Have anyone of you encountered such a bizzare error.
    Thanks,
    Vikas

  • How to run Applet using jsp in netbeans 5.5

    hi,
    I want to run an applet program using jsp and tomcat. I have created an applet class in NetBeans 5.5 and also a Jsp. In that jsp I have given the <jsp:plugin type="" code="" ......> tag. But its not warking. Can any one please tell me the correct steps to run that applet?
    Thanks

    no clue???????????

Maybe you are looking for

  • App Store: Unconfirmed buy after clicking on URL ("silent buy")?

    Hi Forum, Last Friday I bought on my new iPad without my confirmation ("Click on Price or Purchase") 2 applications by simply clicking on a web link which opened the App Store on my new iPad! Yes, you read correct: I did NOT confirm the purchase by c

  • RCA Adapter

    Why can't I use a dvi to rca adapter on a g4? I'm trying to use a tv as a second monitor. I can do this on my g5 with fcp5. On my g4 I want to do the same thing for ae6. The adapter says for a g5. But what difference does it make. Is the signal diffe

  • Tray selection

    when I first had  my officejet HP pro 8500 wireless it used to select tray 1 whenever Iprinted an envelope. it does not now . WHY?

  • Windows live photo acquisitio​n wizard has stopped working

    my window live photo acquisition manager has stopped working,,, has anyone else experienced this ,, if so is there a solution to this error,

  • Mail 2.07 and airport express

    I am having problems sending mail, expecially with attachments. My ISP told me that Mail 2.07 was unstable with SSL using airport express. They told me to change the airport express MTU setting to 1500 but I don't know where to find this setting. Any