I need the java launcher command line that runs my program from eclipse 3.5. Where do I find that?

I know there are workarounds, but I need to find the command line string that eclipse generates to run my class.  I have numerous jars and I need to cut and paste that string into another application. I am looking for the command generated by eclipse, i.e java -cp .....

Running Eclipse 3.5 on Fedora 12.
Sarge516Asked:
Who is Participating?
 
gksinghietConnect With a Mentor Commented:
Use this small Test class to know the classpath eclipse is using.
Run this from your project:
import java.net.URL;
import java.net.URLClassLoader;


public class ClasspathTest {

  /**
   * @param args
   */
  public static void main(String[] args) {
    //Get the System Classloader
    ClasspathTest test = new ClasspathTest();
    ClassLoader sysClassLoader = test.getClass().getClassLoader();

    //Get the URLs
    URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();

    for(int i=0; i< urls.length; i++)
    {
        System.out.println(urls[i].getFile());
    }    

  }

Open in new window

0
 
Gurvinder Pal SinghCommented:
java -classpath ..\lib\jar1;..\lib\jar2 classname
0
 
TomLunCommented:
Well, since this is on Fedora I'd use : as the separator between the parts in the classpath i.e.
  java -cp ../lib/jar1;../lib/jar2 fully-qualified-classname
0
 
Sarge516Author Commented:
I was trying to get what eclipse generates, but that might not be possible. This solution would work for what I need to do.

Thanks!
0
 
gksinghietCommented:
Thanks for the point and rating :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.