Java Reference
In-Depth Information
As the applications you write become more complex, you will run into unexpected results and problems (such as
endless loops) that prevent the application from responding or stopping. Try to remember to use the Task Manager; it
is your escape hatch from such problems.
Importing into RAD
Importing allows programmers to bring files from outside of the RAD workspace into a project. Java source code files can
be imported, as well as, many other types of files (image, database, web page, etc.). To import, RAD simply requires that
a project already exists. If an application were exported, how and what was exported has implications for importing. For
example, earlier only myFirstPackage and the .class files were exported (i.e., the project, bin, and src folders and were
not exported). If myFirstPackage and the .class files were imported, the application could not be run because RAD's Java
perspective does not provide access to the .class files. To import and access an application in the Java perspective the
source files have to be imported. This means the source code has to be exported if you want to import.
An entire project can be exported and imported very easily. However, this makes running the application more
complicated because the entire folder structure will be exported. Figure A-26 shows the folder structure for the .java
and .class files if the whole project is exported. In addition, this takes up a lot of space.
Figure A-26.
In the real world, Java applications are usually exported and transported as JAR files. However, the project
structure is not preserved and if the whole JAR file is imported, the source code is not put in the correct location
within the project. To avoid this problem we need to specify that only myFirstPackage be created in NewProject/src
when importing.
Let's prove it.
Tutorial: Importing into RAD
Now let's import into RAD:
1.
Export all of MyFirstProject to the F: by selecting it in the Package Explorer then click File
and Export.
2.
At the Export window, expand Java, select JAR file, then click the Next button.
3.
At the JAR Export window, click MyFirstProject's checkbox twice to select the project and
all its subfolders.
 
Search WWH ::




Custom Search