-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Could not find ./.env on the file system (working directory:/) #56
Comments
I'm using GraalVM native-image on pc. Ok, because String projectPath = System.getProperty("user.dir", ".");
if (!projectPath.contains("server")) {
projectPath = projectPath + "\\server\\";
}
System.out.println("Current resource path: " + projectPath);
Dotenv dotenv = Dotenv.configure().directory(projectPath).load(); I put the .env under the server root-folder
| __ client
| __ server/
| __ resource/
| __ .env (not in here)
.env (here)
pom.xml |
Have a look at the android usage section here Note the use of env not .env |
I make a mistake. I thought this was on PC but it's mobile. But still, I'm trying to get it working with spring-boot and graalvm |
Hi readers
I am setting up this package in my java project, have added dependency and also created a .env file
but when calling configure() as mentioned below
Dotenv dotenv = Dotenv .configure() .load();
I followed your document but i want to use .env file from the root of the project for example : exampleproject/app/.env
and getting this error every time i do
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8757) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) Caused by: io.github.cdimascio.dotenv.DotenvException: Could not find /.env on the classpath at io.github.cdimascio.dotenv.internal.ClasspathHelper.loadFileFromClasspath(ClasspathHelper.java:25) at io.github.cdimascio.dotenv.internal.DotenvReader.read(DotenvReader.java:55) at io.github.cdimascio.dotenv.internal.DotenvParser.lines(DotenvParser.java:87) at io.github.cdimascio.dotenv.internal.DotenvParser.parse(DotenvParser.java:60) at io.github.cdimascio.dotenv.DotenvBuilder.load(DotenvBuilder.java:76) at com.example.activity.splash.onCreate(Splash.java:33) at android.app.Activity.performCreate(Activity.java:8591) at android.app.Activity.performCreate(Activity.java:8570) at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1384) at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:4150) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:4325) at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:101) at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135) at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2574) at android.os.Handler.dispatchMessage(Handler.java:106) at android.os.Looper.loopOnce(Looper.java:226) at android.os.Looper.loop(Looper.java:313) at android.app.ActivityThread.main(ActivityThread.java:8757) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067) Suppressed: io.github.cdimascio.dotenv.DotenvException: Could not find ./.env on the file system (working directory: /) at io.github.cdimascio.dotenv.internal.DotenvReader.read(DotenvReader.java:60)
I ended up pasting .env file on every root of the project for example project/app/ , project/ , project/app/src ... but nun of that worked. !
The text was updated successfully, but these errors were encountered: