I have an application that some of my users run from Eclipse, and others run it using a jar file.
I want some actions to go from within the jar, but I do not want them to keep going from eclipse.
What is the way to know the Runtime? Is the current application running from within a jar?
Thank you!
Dikla
Well, you can tell that a class with jars Whether or not loaded - use Foo.class.getResource ("Foo.class")
and see if the returned URL starts or does not "jar:"
For example, do this program:
package com.whatever;
public class Foo {public static zero main (string) [] args) {System.out.println (Foo.class.getResource ("Foo.class")); }}
Loading file from file system:
file: / c: / user / john / test / com / jo / foo .class
is being played from a jar file:
jar: file: / c: / user / jon / test / foojar ! / Com / whatever / foo class
Comments
Post a Comment