Link to home
Start Free TrialLog in
Avatar of Tolgar
Tolgar

asked on

How to debug JAVA code in Eclipse by setting input variables permenantly?

Hi,
I have a Java code and I want to debug it in Eclipse.

I call this Java code from a Perl code normally. So there are some input arguments to Java code from Perl.

What I want to do is to set these input parameters somewhere in Eclipse as parameters and run the Java code in debug mode in Eclipse.

How can I do it?

Note: Normally I create a jar file from my Java code by saying java -jar  .... I believe this will not change anything but I wanted to mention it just in case.


Thanks,
Avatar of for_yan
for_yan
Flag of United States of America image

In Eclipse project you right click poroject in project browse and
selec I guess it is called Run Configuration - select default and
then there i a box Program Varibales - you shoul put in this box all parameters which normaly
come to you from PHP.

You of couse should not rely on Jaer - when debuing in Eclipse - you should have a source Java code corresposining to your classes and importa java codes into Eclipse project
Avatar of Tolgar
Tolgar

ASKER

Ok I think I have main prolem.

I already have a my java code as a jar file.

Can you please explain me how I will create a project in Eclipse first from this jar file. This code uses other jar files. So what I normally do is:

I create jar file using Maven and put the jars and the .jar file in one directory. Then it works.

Now, how can I put all these (.jar libraries and .jar source code) in Eclipse and debug?

Thanks,
You expand your jar (you can rename .jar to .zip and it will open it with WinZip).
Then from your own part (for which you have source code) - you use only source code - you don't need class files for these classes
For third party classes - you need yourr jar files

Then you create your project - it will create folder and create src folder inside
You put your java sorece files in the folder structure as they should be in that src
folder and then you right-click your project and select Build Path and again Configure Build path form submenu
and then on the popup winodw press button add external jars and then you navigate to your third party jars and
add them


ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial