Необходимость сборки Electric из исходных текстов возникает редко, поскольку загруженный код уже готов к исполнению. Для тех коллег, которые желают исследовать исходный текст, опишем здесь некоторые из шагов.
Первый шаг в построении исходного кода состоит в извлечении его из .jar файла. Чтобы сделать это поместите .jar файл в отдельную папку, выберите эту директорию, и выполните команду:

jar xf electric-version.jar

(Пользователи Windows могут установить cygwin с сайта http://www.cygwin.com/ , в нем можно быстрее и удобнее выполнять jar и другие команды.) jar откроет следующие файлы и папки на вашем диске:
com - папка содержит исходный код.
packaging - в этой папке находятся вспомогательные файлы, необходимые для сборки.
META-INF впсомогательная папка используется в процессе работы .jar файла и может быть удалена.
build.xml - это Ant скрипт для сборки Electric.
ChangeLog.txt - детальный список изменений Electric.
COPYING.txt - это документ, содержащий правила использования Electric.
README.txt - файл, содержащий дополнительные заметки о Electric.

исходный код Electric также доступен из GNU Savannah repository подключаемых командами:

svn co svn://svn.savannah.gnu.org/svn/electric/trunk
svn co http://svn.savannah.gnu.org/svn/electric/trunk

которые извлекут код в выбранную директорию (желательно чтобы в ней до этого не содержалось никаких файлов).

Следующий шаг состоит в получении версии Java которая сможет построить исходный код. Хотя JRE (Java Runtime Environment) достаточно для запуска Electric, с его помощью нельзя выполнить построение приложения из исходного кода. Для этого вам понадобится JDK (Java Development Kit). Вы можете также использовать интегрированную среду разработки (Integrated Development Environment, IDE) подобную NetBeans www.netbeans.org или Eclipse www.eclipse.org

Running under Eclipse

Here are some notes about building Electric under Eclipse:
Setup Workspace. The Workspace is a point in the file system where all source code can be found. You can use the directory where you extracted the Electric source code, or any point above that.
Create Project. The Project defines a single program that is being built. Use New Project under the File menu and choose "Java Project". Choose "Create project from existing source" and browse to the folder where the files were extracted. Give the project a name, for example, "Electric."
Configure Source Code. The "Source" tab of the Eclipse project settings shows the files that were discovered. Make sure that the extracted directory is included (along with everything else under it).
Configure Libraries. The "Libraries" tab of the Eclipse project settings lets you add other packages that may be relevant to the build. There are no required libraries, but many optional ones (see Section 1-5 on plug-ins). Use the "Add External JARs" button to add any extra libraries.
Handle Macintosh variations. If you are building on a Macintosh, no changes are needed. If you are not building on a Macintosh, you must decide whether or not you want the code that you produce to also run on a Macintosh. If you do not care about being able to run on a Macintosh, remove the source code module "com.sun.electric.tool.user.MacOSXInterface.java" (which probably has a red "X" next to it indicating that there are errors in the file). If you want the final code to be able to run on all platforms, download the stub package "AppleJavaExtensions.jar" from developer.apple.com/samplecode/AppleJavaExtensions and add this as an external JAR file.
Run Electric. Use the Run... command (under the Run menu) to create a run configuration. Under the "Main" tab of the run-configuration dialog, give the configuration a name (for example, "Electric"), set the Project to match the one that you have created, and set the "Main class" to be "com.sun.electric.Launcher". Under the "Arguments" section of the dialog, it is a good idea to increase Electric's memory size by entering "-mx1000m" under "VM arguments".

Running under Netbeans

The best way to use Netbeans is to extract the source code from the Savannah repository, as described above. If you do this, you will have a directory called "trunk". The first step is to add the Bean Shell to the build, which can be done by changing to the "trunk" directory and running the "make" command.

Next start Netbeans and open the "electric-netbeans" project that is in the "trunk" folder. You should be able to build the man project (under the "Run" menu)and then run or debug the main project.

Using Ant

"Ant" is a scripting system for building Java programs, and Electric comes with an Ant script file called "build.xml". Once the source code is extracted, you can build Electric simply by typing Ant commands. The Ant target "runFromBin" will build and run Electric. The Ant target "jarForGNUBinary" will build a new ".jar" file from the source code.

Note that when using Ant, there are some Macintosh vs. non-Macintosh issues to consider.
Build on a Macintosh The easiest thing to do is to remove references to "AppleJavaExtensions.jar" from the Ant script. This package is a collection of "stubs" to replace Macintosh functions that are unavailable elsewhere. You can also build a native "App" by running the Ant target "mac-app". Macintosh computers must be running OS 10.3 or later.
Build on non-Macintosh If you are building Electric on and for a non-Macintosh platform, remove references to "AppleJavaExtensions.jar" from the Ant script. Also, remove the module "com.sun.electric.MacOSXInterface.java". It is sufficient to delete this module, because Electric automatically detects its presence and is able to run without it.
Build on non-Macintosh, to run on all platforms To build Electric so that it can run on all platforms, Macintosh and other, you will need to keep the module "com.sun.electric.MacOSXInterface.java". However, in order to build it, you will need the stub package "AppleJavaExtensions.jar". The package can be downloaded from Apple at developer.apple.com/samplecode/AppleJavaExtensions.

Яндекс.Метрика