System.getenv返回null(尝试了所有其他解决方案)

时间:2018-06-03 19:49:41

标签: java macos environment-variables

  1. 这是一个macOS High Sierra 10.13.2
  2. 我将export DATABASE_URL=mysql://username:password@localhost:3306/mydb放入~/.bash_profile,重启机器并确保在终端I运行echo $DATABASE_URL时获取值。 2.我使用sudo ./eclipse启动eclipse 3.也使用launchd.conf,但显然在最新版本的MacOS中不支持。
  3. 我在这里缺少什么?

    更新1 当我运行./eclipse时,我在控制台上收到此错误:

    java.lang.RuntimeException: Error initializing storage.
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:77)
        at org.eclipse.osgi.launch.Equinox.<init>(Equinox.java:31)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:295)
        at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:231)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:648)
        at org.eclipse.equinox.launcher.Main.basicRun(Main.java:603)
        at org.eclipse.equinox.launcher.Main.run(Main.java:1465)
    Caused by: java.io.FileNotFoundException: /Users/myuser/eclipse/configuration/org.eclipse.osgi/.manager/.fileTableLock (Permission denied)
        at java.io.RandomAccessFile.open0(Native Method)
        at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
        at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
        at org.eclipse.osgi.internal.location.Locker_JavaNio.lock(Locker_JavaNio.java:36)
        at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:388)
        at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:701)
        at org.eclipse.osgi.storage.Storage.getChildStorageManager(Storage.java:1749)
        at org.eclipse.osgi.storage.Storage.getInfoInputStream(Storage.java:1766)
        at org.eclipse.osgi.storage.Storage.<init>(Storage.java:126)
        at org.eclipse.osgi.storage.Storage.createStorage(Storage.java:85)
        at org.eclipse.osgi.internal.framework.EquinoxContainer.<init>(EquinoxContainer.java:75)
        ... 10 more
    

0 个答案:

没有答案