aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Mass Loading of Java Programs into NetBeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Mass Loading of Java Programs into NetBeans" Watch "Mass Loading of Java Programs into NetBeans" New topic
Author

Mass Loading of Java Programs into NetBeans

Niels Laughlin
Greenhorn

Joined: Apr 04, 2006
Posts: 19
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.
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
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.


"I'm not back." - Bill Harding, Twister
Niels Laughlin
Greenhorn

Joined: Apr 04, 2006
Posts: 19
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.
Frank Carver
Sheriff

Joined: Jan 07, 1999
Posts: 6920
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?


    Read about me at frankcarver.me ~ Raspberry Alpha Omega ~ Frank's Punchbarrel Blog
    Niels Laughlin
    Greenhorn

    Joined: Apr 04, 2006
    Posts: 19
    Thanks. This is exactly what I needed. I got it working now.
    Timothy Frey
    Ranch Hand

    Joined: Jul 22, 2006
    Posts: 56
    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

    Joined: Apr 04, 2006
    Posts: 19
    This response was even better. Thanks.
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: Mass Loading of Java Programs into NetBeans