Reputation: 49
I have a large code base that resides on a unix server, and for the sake of improving the efficiency of writing future code and debugging that which already exists, I would like to move whatever code I can into an eclipse project and debug it from there.
I have looked at remote debugging but I would prefer to be able to debug the majority of the code locally. Most of the code is written in java but running it relies on a few unix and perl scripts.
If anyone could point me in the direction of anything useful that will help me to take this mammoth code base into an eclipse project, setting up the proper debug configuration with suitable paths etc. I would be very grateful. Even a general document which I can adapt to suit my needs would be a bonus. I realise that a succinct answer is unlikely.
Thanks in advance.
Upvotes: 1
Views: 333
Reputation: 13914
I assume (?) that you're not on a Unix (Linux, MacOS, BSD, …) system, by the question?
The specifics are going to be very specific to your project. However, the brief answer will be:
To actually import the project(s): * Make sure your Eclipse has the Java plug-ins (always? included) and (if you need it for native code) the CDT (C/C++ development toolkit) installed; * Create two projects, one for Java, one for native code, and set them as part of the same Working Set, and/or relate them as one being a dependant project of the other; * Lots of fiddling with Project Properties. In general, Unix Makefile-driven C code will work under a GCC toolchain setting without much (if any) fidgetting.
You may find yourself wanting to change file paths for your project on workstation vs. server builds; I strongly suggest using a “define” prefix macro: e.g. the traditional GNU macro is _prefix
, and on a Linux host is generally /usr/local
for test builds and /usr
or /opt/product-name
for release builds (give or take); you could perhaps define _prefix
to C:/Users/JohnDoe/product-name/
(yes, the /
works on Windows, and makes Unix code much happier) and edit the strings appropriately, if you have hard-coded path names in the code.
Unfortunately, Java doesn't really support using a “define” system, but you'll probably either bundle your resources and access them in the native way (relative to your JAR/classpath…) or set them using a .properties
file or similar.
Upvotes: 1
Reputation: 115378
Important questions are how many dependencies does your project have now and what tool is used to build it?
If you are using maven you can just install maven you can create eclipse project by running mvn eclipse:eclipse
and then open your project in eclipse.
If it is ant project try to find tool that creates eclipse project from ant script (if such tool exists). If not create the project manually and configure all dependencies.
Once you are done you can run and debug the java part of your code.
Perl is not a problem. Just install it on your dev. machine. The shell scripts might cause some problems if you are using Windows for development. The way to run unix scripts on windows is using Cygwin. You will have to change (a little bit) the code that runs scripts to add prefix cygwin
there when you are on windows.
After that I hope you will be able to run and debug it locally.
Or, alternatively you can move to Linux. In this case you will not have problems with scripts. If you cannot move to Linux totally (dependencies on MS Office, Outlook, company policy etc) you can install VMPlayer with one of popular Linux distributions (e.g. Fedora, Ubunty etc) and work on this virtual machine that will run on Window box.
I hope this helps. Good luck.
Upvotes: 0