Skip to content

Instantly share code, notes, and snippets.

@Jukkales
Created May 21, 2019
Embed
What would you like to do?
IntelliJ Plugin ClassNotFoundException
public class MyAction extends AnAction {
@Override
public void actionPerformed(AnActionEvent e) {
try {
String fileName = Objects.requireNonNull(e.getData(DataKeys.VIRTUAL_FILE)).getCanonicalPath();
FileBasedConfigurationBuilder<FileBasedConfiguration> builderOrig = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
PropertiesConfiguration.class).configure(new Parameters().properties().setFileName("test.properties"));
PropertiesConfiguration config = (PropertiesConfiguration) builderOrig.getConfiguration(); // Class not found Exception "PropertiesConfiguration"
System.out.println(config.getProperties("this.is.a.test"));
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
plugins {
id 'org.jetbrains.intellij' version '0.4.8'
}
apply plugin: 'org.jetbrains.intellij'
apply plugin: 'java'
apply plugin: 'idea'
sourceCompatibility = javaVersion
targetCompatibility = javaTargetVersion
group 'de.group.id'
version '0.1'
tasks.withType(JavaCompile) { options.encoding = 'UTF-8' }
intellij {
version ideaVersion
type ideaType
pluginName pluginName
}
repositories {
mavenCentral()
maven { url 'https://dl.bintray.com/jetbrains/intellij-plugin-service' }
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.8'
annotationProcessor 'org.projectlombok:lombok:1.18.8'
compile 'commons-beanutils:commons-beanutils:1.9.3'
compile 'org.apache.commons:commons-configuration2:2.4'
}
public class Main {
public static void main(String[] args) throws ConfigurationException {
FileBasedConfigurationBuilder<FileBasedConfiguration> builderOrig = new FileBasedConfigurationBuilder<FileBasedConfiguration>(
PropertiesConfiguration.class).configure(new Parameters().properties().setFileName("test.properties"));
PropertiesConfiguration config = (PropertiesConfiguration) builderOrig.getConfiguration(); // Works fine
System.out.println(config.getProperties("this.is.a.test"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment