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

Posted on 2011-10-06
Last Modified: 2012-05-12
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.

Question by:Tolgar
    LVL 47

    Expert Comment

    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

    Author Comment

    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?

    LVL 47

    Expert Comment

    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

    LVL 47

    Accepted Solution

    And then as I metioned before right-click oprojects and sleecet Run As and then select Run Configurations and then in thepopup window
    you select tab Arguments and in the pRogram Arguments window you type your arguiuments wjhich you'll normally get from from

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
    This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
    This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now