microsoft / oauth2-useragent

Microsoft OAuth 2.0 User Agent library for Java. Provides classes to facilitate the implementation of "4.1. Authorization Code Grant" from RFC 6749.
Other
35 stars 22 forks source link

The way JavaFX provider sets up classpath is problematic #9

Closed yacaovsnc closed 8 years ago

yacaovsnc commented 8 years ago

Currently, this is the piece of code we use to locate our own jar and add it to the classpath: (UserAgentImpl.java class)

// TODO: is this the best way to add our JAR?
classPath.add(System.getProperty("java.class.path"));

It turns out this isn't the best way. :smile: In a plugin setting (IntelliJ plugin in this case), our jar is loaded by a plugin classloader and it doesn't appear on the "java.class.path".

Then we got a silent error, tracing the call stack and we see:

Error: Could not find or load main class com.microsoft.alm.oauth2.useragent.JavaFx

Need either a better way to locate our jar, or expose a method to augment the process with correct classpath -- I personally prefer method to augment the classpath so the consumer of this library will be responsible for detecting the correct path. This way consumer has more flexibilities.

yacaovsnc commented 8 years ago

Oh well, I guess one way to augment the process is to set the "java.class.path" property. Hacky though...

yacaovsnc commented 8 years ago

We improved the way we locate the jar, so the need for augment classpath isn't obvious anymore. Let's close this issue and open another one if we still feel the need for classpath augmentation.