# The Jedi Tutorial

previous | by Andreas Raquet | next

### Importing and exporting

Java code written in Jedi is stored in a special format that is easy to access for Jedi. However for obvious reasons it might still be necessary to import and java sources. Jedi provides import and export features which we will explore here by showing of importing and exporting to and from the HelloWorld project.

### How to import code

First open the import dialog using the 'Import' entry in the 'Project' menu. A filerequester will show up where you can select all the `.java` files you wish to import from. Go to your Jedi installation directory and select '`tutorial/GUIWorld.java`', then hit '`Ok`'. Another window will appear where you can choose which classes you wish to import. Hit the '>>>' button to tag the class for import. Then hit 'Ok'. After a while, the new class should appear in your browser.

What you have just imported is a GUI frontend for our HelloWorld. It opens a new window that displays the text. Before you can see this, you will of course have to recompile everything. You should do that now. But if you click the 'launch' icon afterwards, you will still get the console-based program. The reason is that there are two executable classes now (HelloWorld and GUIWorld) and Jedi will launch the one that was launched before.
You can easily change that default, though. Click on the 'select executable' icon in the toolbar. It shows a capital 'M'. Then select 'GUIWorld' and hit 'Ok'. When you click on the 'launch' icon now, the window should appear.

Note: When importing sources, Jedi parses their structure according to the official Java specification. If they to not comply, Jedi will refuse to load them. Unfortunately some java compilers, most notably JDK, do not check syntax as strictly. Thus some sources that compile with JDK will not be accepted by Jedi. This is not a Jedi bug, but a syntax error in the sources, that is ignored by JDK. Importing these sources to other Java IDE's would cause the same problems.

### How to export code

Exporting is an equally simple operation. Select the 'Export' entry in the 'Project' menu. A filerequester will let you specify a target directory. Choose, for example, your home directory and hit 'Ok'. Now take your favourite filemanager and take a look. Jedi has created a directory named after your project, HelloWorld. Inside you will find a directory '`src`' which contains all the `.java` sources. From here you can import to other IDEs.
In addition there are other directories: `classes`, `doc`, `lib`, `bin` - the structure is pretty common for commandline based development and only interesting if you want to use JDK. If that is the case, open a shell, go to the `HelloWorld/src` directory and type `make`. The makefile will compile the project and create `.class` files in '`../classes'`, a `.jar` file in '`../lib`' , HTML documentation in '`../doc`' and even a startup script in '`../bin`'.

This should be enough information to handle import and export of java sources. The next chapter will cover java class libraries and jar files.

previous | 30.08.1999 | next