Accessing the .NET AppConfig File
You are browsing legacy Javonet 1.5 (Java<>.NET bridge for Windows) documentation. Use the left side menu or click here to switch to latest Javonet 2.0 documentation. Javonet 2.0 allows you to use any module from
JVM, CLR, Netcore, Python, Ruby, Perl, NodeJS on Windows, Linux and MacOs
from any application created in Java, Clojure, Groovy, Kotlin, C#, F#, J#, VB.NET, Python, Perl, Ruby, JavaScript, TypeScript, C++ and GoLang
Accessing the .NET AppConfig File (connectionStrings and appSettings)
If your .NET logic uses App.Config files, reads information from connectionStrings sections, appSettings or needs any other data from configuration, you can use Javonet to load this file.
To do this, use the following method in your application. This method should be called just after activating Javonet and before any other operation. Simply add this method to your application and call it by passing the path to your config file.
Javonet.activate("[email protected]", "your-license-key", JavonetFramework.v40);
String configFilePath = new File(".").getCanonicalPath() + "\\app.config";
Javonet.getType("AppDomain").getRef("CurrentDomain").invoke("SetData", "APP_CONFIG_FILE", configFilePath);
// Todo: Your Javonet powered application code
Was this article helpful?