• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Mass Loading of Java Programs into NetBeans

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just bought Cay Horstmann's Core Java 2 book and have downloaded his program samples. I would now like to mass load them into NetBeans. I know how to copy/paste them one at a time and have done a few. Is there a better way to do them in one shot? Eclipse appears to be able to do that but I really don't want to learn another IDE at this time. Thanks.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are probably instructions for this somewhere in the introduction or forward or something similar. But many/most computer books nowadays have web sites where you can download the code, and Core Java is no exception. Try here. Look for the word "download" and follow the appropriate link for the version you have.
 
Niels Laughlin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
My question was not understood. I did download the program samples from the website. They are in a .zip file on my PC. I also successfully unzipped them. My problem now is how to get them into NetBeans en masse. NetBeans has its own directory structure that is not the same as the one unzipped. I can of course cut and paste them one at a time but there should be a simpler way to do that. I'm heading off to Borders right now to see if there is a NetBeans book that will explain how to do this. Thanks for taking the time to reply, Sheriff.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
NetBeans has its own directory structure that is not the same as the one unzipped

I'm not sure I understand this. Does NetBeans really force you to layout your software projects the way it wants? If that's the case nobody would ever use it on software started using some other method, and tht's nuts!

Are you really sure that NetBeans doesn't have a way to create a new project from your existing source code?

A quick look round the web led me to http://java.sun.com/developer/onlineTraining/tools/netbeans_part1/

which states:


Importing Existing Java Source Code Into NetBeans

You can use two project templates to import your existing source code:

  • Java Project With Existing Sources -- Use this project template to create a standard Java project. A standard Java project uses the IDE to compile, run, and debug your application.
  • Java Project With Existing Ant Script -- Use this project template to create a free-form Java project. A free-form Java project uses your own Ant script to compile, run, and debug your project.


  • The following steps cover use of the first template to create a standard Java project without the use of existing Ant scripts.
  • Choose File -> New Project (Ctrl-Shift-N).
  • Choose General -> Java Project With Existing Sources.
  • Click Next.
  • In the Project Name field, type a name for your project. Notice that the IDE automatically suggests a name for the project folder.
  • Click the Browse button next to the Project Folder field and create a folder somewhere on your system for your NetBeans projects. Then select the newly created NetBeans projects folder. Be sure to select the Set as Main Project box, then click Next.
  • In the Source Packages Folder pane, click Add Folder, navigate to the directory of source files, and select the resources and src folders.
  • (Optional) In the Test Packages Folder pane, click Browse to select the folder containing the JUnit package folders.
  • Click Finish.



  • Your project will now be displayed in the Projects and Files windows.



    Does that help?
     
    Niels Laughlin
    Greenhorn
    Posts: 19
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    Thanks. This is exactly what I needed. I got it working now.
     
    Ranch Hand
    Posts: 56
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    In case you already have a NetBeans project set up, there is a way that you can "import" source files into your current project. Unlike some IDEs (like Eclipse, I believe), there is no "import" function in the file menu. However, if you navigate to your project's folder in Windows explorer (or whatever OS you are using), you can just dump your files under the src directory and NetBeans will pick them up automatically.

    For example, if your project is called "MyProject" and is found in "C:\Java\MyProject", navigate to "C:\Java\MyProject\src" and just paste the Java files in there. NetBeans will recognize the change and add them automatically to the file tree in the IDE.
     
    Niels Laughlin
    Greenhorn
    Posts: 19
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator
    This response was even better. Thanks.
     
    reply
      Bookmark Topic Watch Topic
    • New Topic