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.
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
posted 12 years ago
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.
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?
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.
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.
Your project will now be displayed in the Projects and Files windows.
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.