Differences
This shows you the differences between two versions of the page.
help:sysnews:java_system_tips [2011/09/22 13:43] |
help:sysnews:java_system_tips [2011/09/22 13:43] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Java issues and tips ====== | ||
+ | |||
+ | |||
+ | |||
+ | ===== Java remote method invocation problem ===== | ||
+ | |||
+ | Problem: When running a demo of Java's remote method invocation on our Ubuntu 9.04 based linux machines running java-6-openjdk the client could only attach to a server running on the same host. | ||
+ | |||
+ | Solution: Professor Ellman discovered that the fix is to explicitly tell the server its hostname or IP address. This is accomplished by adding ``-Djava.rmi.server.hostname=[IP or Name of HOST]`` to the java command when starting the server, so for a server named ``hopper`` with an IP address of ``10.0.0.63`` you can do either: | ||
+ | < | ||
+ | or | ||
+ | < | ||
+ | both of which worked. | ||
+ | |||
+ | Without specifing this option the server is only listening on the loopbak device. | ||
+ | |||
+ | |||
+ | ===== Adding Java Web with Tomcat 6 to Netbeans 6.5 ===== | ||
+ | Note: these instruction are for the setup in the Vassar College Computer Science Department Lab. They may contain information not appropriate to an install elsewhere. | ||
+ | |||
+ | ==== 0) Overview ==== | ||
+ | This setup will let you run your own tomcat webserver on the local machine for building and debugging apps in netbeans. There is one command to be typed in a terminal, all other steps will be preformed from within netbeans. | ||
+ | |||
+ | |||
+ | ==== -) Create a local copy of the needed tomcat files ==== | ||
+ | - open a terminal | ||
+ | - enter the command | ||
+ | < | ||
+ | tomcat6-instance-create ~/mytomcat | ||
+ | </ | ||
+ | |||
+ | ==== -) Open Netbeans ==== | ||
+ | Netbeans can be invoked either by typing ``netbeans`` in a terminal, or by menu selection. | ||
+ | |||
+ | |||
+ | === -) Install Additional Plugins === | ||
+ | You will need the plugins ``Java Web Applications`` and ``Tomcat``. | ||
+ | |||
+ | Depending on what you have done with netbeans in the past, | ||
+ | some or all the needed plugins may already be installed. | ||
+ | |||
+ | To get to the ``Available Plugins`` list, select | ||
+ | |||
+ | - ``__T__ools`` --> ``Plu__g__ins`` --> ``Available Plugins`` | ||
+ | - Check [✔] ``Java Web Applications`` and ``Tomcat`` then select ``__I__nstall`` | ||
+ | - Once it installs the plugins it will prompt you to restart netbeans. | ||
+ | |||
+ | {{sysnews: | ||
+ | |||
+ | |||
+ | === -) Set up the Tomcat Server === | ||
+ | When netbeans restarts, add the tomcat server. Select | ||
+ | |||
+ | - ``__T__ools`` --> ``__S__ervers`` --> ``__A__dd server`` --> ``Tomcat 6.0`` --> ``Next >`` | ||
+ | - Fill in ``__C__atalina Home:`` as ??/ | ||
+ | - Check (✔) the box for ``U__s__e Private Configuration Folder (Catalina Base)`` | ||
+ | - Fill that in with the name of the directory you created in the first step, you will need to give it the absolute path. (Replace ?? | ||
+ | - Fill in something in the ``__U__sername`` and ``__P__assword`` fields. | ||
+ | - Check (✔) the box labeled ``Enable HTTP Monitor`` | ||
+ | |||
+ | When you select ``Close`` netbeans will save your server settings. | ||
+ | |||
+ | |||
+ | |||
+ | ==== You can now begin a project using your Tomcat server ==== | ||
+ | To do this, select | ||
+ | |||
+ | - ``__F__ile`` --> | ||
+ | - in the column ``__C__ategories: | ||
+ | - in the column ``__P__rojects: | ||
+ | - select ``Next >`` | ||
+ | - Enter your ``Project __N__ame:`` or keep the default. | ||
+ | - Enter your ``Project __L__ocation: | ||
+ | - Select ``Next >`` | ||
+ | - for ``__S__erver: | ||
+ | - the rest of that page can be left at the default settings. | ||
+ | |||
+ | ===== Tomcat server can't start because one is already running on that port particular ===== | ||
+ | There are two likly causes of this. They each have a different solution. | ||
+ | |||
+ | | ||
+ | |||
+ | Should do it. If it does not, then someone else has a server running. | ||
+ | |||
+ | * Write me, tell me the name of the machine, the time of day and the ``Ser__v__er port`` listed when you look at the server properties (``__T__ools`` --> ``__S__ervers``) | ||
+ | * Change your server to run on a different port. | ||
+ | ``__T__ools`` --> ``__S__ervers`` --> ``Ser__v__er Port``, increment it a bit. ``Close``. See if that helps. | ||
+ | |||
+ | |||
+ | --- // | ||
+ | |||
+ | |||