Just bring me to the FAQ.
The purpose of this mini-tutorial is to get new Jacob users started and to demonstrate it's basic features.
Therefore use Jacob's menu at 'Edit->Add Package...', type in 'jacob.tutorial', and press 'OK'.
Now, this package should be listed in the top list window. Clicking
on this String should reveal the names
of two classes in the middle list window ('Main' and 'World').
If you properly set up Jacob then clicking on one of these two class names should load the appropriate source code into Emacs. In the bottom window you see the string "<parse>". Click on it and Jacob will parse the current source file and display the methods of the current class. In this case there exists only one method. Of course, now you can use this/these method(s) for navigation too. The height of each list window can be changed. Simply click on a bar between two lists and move it up or down. When the project gets saved, the list window heights will be stored for each project individually.
It's time to save your project file ('File->Save') and create a makefile
('File->Create Makefile').
Your project file is stored at .../jacob/tutorial/tutorial.proj
and the makefile is likewise stored in the same directory.
You can take a look at this makefile with 'Edit->Makefile'. Now go
back to one of the source files inside Emacs and start the compile process
with the elisp function compile, which in fact starts make.
This should compile both java source files.
BTW this is the elisp code I use to compile.
(defun my-compile () (interactive) (if (string= major-mode "java-mode") (progn (compile "make all") ) ) ) (global-set-key [f10] 'my-compile)Next you want to start and test this application from inside Emacs. First Jacob must know which of your project classes is the one with the public static void main(String[]); routine. This can be specified at the Project Settings Dialog ('Edit->Project Settings...'). Press Select News and select 'Main'. Now recreate the makefile ('File->Create Makefile'). When looking again at the produced makefile, there is a new section run:. To execute the hello world
(defun my-run () (interactive) (if (string= major-mode "java-mode") (progn (shell-command "make run &") ) )
) (global-set-key [f9] 'my-run)Now hit this key and you should see the 'hello, world' output.
We use this window now to jump from method to method until we get out of the project's scope. Click now on jacob.tutorial.World.World(). Emacs jumps to that method and also selects it in Jacob. Press again the "<parse>"-button and select java.lang.Object.Object(). Oh, bad luck, in Object.java is no constructor defined :=(. Anyway, I believe you can surf much longer through your own source files :-).
Then, goto c:\java_apps, do mkdir test, use Jacob "File->Open...", goto c:\java_apps\test, fill in the name test.proj and press ok. Now the project test.proj is opened into Jacob. (The project file itself will be created for the first time when you save this project once.) This creates an empty project.
The project name may be arbitrarily chosen; it does not have to be the same as the directory name within which it is created or the package name. However, it must end with the .proj extension.
Next, set the project's classpath under "Edit->ProjectSettings..." and then select "change classpath". Change the classpath to c:\java_apps;c:\jdk1.1.5\lib\classes.zip, press ok everywhere in this dialog, goto "Edit->Add Package...", type in simply "test" and press ok. It then says "warning: empty package". This is OK.
Note that the classpath should point to the directory containing the package directory tree, i.e. if the package name you choose is myprog.bells.whistle the source files for the package must be created in or copied to the directory myprog\bells\whistle . The classpath should be set to the directory that contains the myprog subdirectory, i.e. if the myprog directory is in c:\java_apps the classpath should be set to c:\java_apps .
Now you need some java classes. Either copy some into the test directory and make sure they contain the package test; statement, create new source files from scratch yourself, or use the "Edit->New Class..." Class Wizard to create a class template file. If you use the class wizard, the new class is automatically included into your project. in the former case, you must include them with "Edit->Add Classes...". Then, jacob scans the test directory and will find every .java file and includes it into the test.proj project. Now would be an appropriate time to save your project data.
Ok, lets recall the steps to create a new project:
1. open a new, empty project in the directory which will contain your source files. 2. set the classpath for this project 3. add a package to the project 4. fill the package with source files 5. save your project data ("File->Save")---
...java.lang.NoClassDefFoundError: com/sun/java/swing/JList
at jacob.Controller.<init>(Controller.java:318)
at jacob.Main.main(Main.java:17)
jacob.Main is in /jacob/main.class
The java VM complains that it cannot find this file. If I mv jacob/main.class to jacob/Main.class, this class loads fine, but the VM then fails to find additional classes. Obviously I do not want to go through all .class files and change them.
If you want to get a new feature into Jacob, feel free to go into details describing it. Otherwise I might not get the idea. :-)
You can also add 'Editor=emacs' in the [Init] section in your initialization file. Then Gnu Emacs starts together with Jacob if Emacs isn't running yet.
You might also think about specifying the 'GnuclientPath' entry in the initialization file in case you have also installed XEmacs with its own gnuserv package on your system.
Go download it from: ftp://ftp.wellfleet.com/netman/psmith/emacs/gnuserv-2.1alpha.tar.gz
Then I downloaded and compiled the newest Emacs source files from http://www.emacs.org/. Unfortunately it's a 14 mb pig.
Now goto the gnuserv source directory and edit the Makefile entry 'Includes' to let it point to the Emacs source directory. Afterwards edit gnuserv.h and make sure
#define UNIX_DOMAIN_SOCKETS
is set and not
#define INTERNET_DOMAIN_SOCKETS.
Now you are ready to compile the gnuserv package. In case you also have XEmacs installed on your system, make sure the gnuserv package from XEmacs is not in your PATH or set the 'GnuclientPath' entry in your Jacob initialization file so Jacob uses the right gnudoit/gnuclient binary.
Just as with XEmacs, you need to insert into your .emacs file the following elisp code:
(require 'gnuserv)
(gnuserv-start)
;; If you want you can specify the gnuserv binary so you
;; don't use the XEmacs gnuserv binary by accident.
;; (setq server-program "/usr/local/gnuserv-2.1alpha/gnuserv")
(setq gnuserv-frame (selected-frame))
Before proceeding with Jacob, you might want to first test manually if gnuclient is working (like with: 'gnuclient ~/.emacs').
Thanks also to Jochen Bedersdorfer who provided me with feedback and was able to get gnuserv working through recompiling gnuserv.el from the XEmacs sources and also using gnuserv from XEmacs. Thought it didn't work out for me this way.
http://www.gjt.org/~sp/jedit.html
In your Jacob startup script make sure the jedit.jar file is part of its CLASSPATH. Then start Jacob with option '-jedit' and jEdit will be started before Jacob gets started itself.
Only file loading and method jumping is supported right now. Other Jacob features like 'Edit->Add Import Statemen...' aren't yet supported together with jEdit.
Thanks to Paddy Ramanathan for providing the base class for this feature.
For example, on Unix you can easily create a file with all your environment variables and values like this without specifying anything by hand:
set > /some_path/environment.properties
Now edit your batch file or shell script which you use to start Jacob and add the option
-DSYS_ENV=/some_path/environment.properties
to the java command. This is what I have in my shell script:
set > $HOME/src/java/jacob/env.properties
$JAVA_HOME/bin/java -DSYS_ENV=$HOME/src/java/jacob/env.properties -classpath $CLASSPATH jacob.Main -inifile $HOME/src/java/jacob/jacob$HOSTNAME.ini $*
Now in the Project Settings dialog you can use environment variables for example to specify your project classpath. The format is the Makefile format for environment variables with a dollar sign and brackets around the variable name like:
$(ENVIRONMENT_VARIABLE)
(require 'gnuserv)
(gnuserv-start)
(setq gnuserv-frame (selected-frame))
to your .emacs (_emacs) file so that the gnuserv process
is running together with Emacs. Only then can gnudoit or
gnuclient load files into Emacs from an external process.
Best to manually test with gnuclient testfile.txt
from the command line if gnuclient works before going forward to use it from Jacob.
2) Of course the gnuserv package has to be installed together
with Emacs. XEmacs normally comes bundled with gnuserv, but
other Emacs implementations need a separate
download
and installation.
3) If this is the case and Jacob has still problems invoking
gnudoit successfully then Jacob just can't locate the
gnudoit executable. Make sure the directory where gnudoit (and
gnuclient) is located in is added to your PATH
environment.
4) Alternatively you can set this in Jacob under
'File->Preferences...' after Jacob has started up. Maybe
you will have to restart Jacob afterwards.
AccessControlException: please relax your security policy for your jdk in order to let the application run with its full functionality. You should grand more permissions in file $JAVA_HOME/jre/lib/security/java.policy. E.g. put 'grant { permission java.security.AllPermission; };' in that file (backup the original content). If you don't want to do anything like this the application should still work with most of its functionality.Then you probably are using e.g. jdk 1.3 with the default security settings which are pretty strict. Jacob on the other hand plays around with standard output and error streams which Java does not allow by default. If you apply the changes mentioned above then Java will not complain any more. But if Jacob can not change standard output it effects only the Java console feature, so the user should not worry to much about the whole warning.
Jdk 1.1 is not effected at all by this security issue.
Back to Jacob's main page