简体   繁体   English

终端在启动Java时自动注销

[英]Terminal automatically logs out when starting java

I just downloaded java onto my Macbook pro (mid 2012). 我刚刚将Java下载到了Macbook pro(2012年中)。 When I click java to start, the terminal window opened but it seems to be automatically logged out. 当我单击Java启动时,终端窗口打开,但似乎自动注销了。 Could anyone help me out? 有人可以帮我吗? What possibly cause this? 是什么原因造成的? I checked around on internet but no luck so far. 我上网查了一下,但到目前为止还没有运气。 I need Java to run Clojure. 我需要Java才能运行Clojure。

Message on the terminal is below 终端上的消息如下

Last login: Tue Jun  7 23:12:35 on ttys001
S-no-MBP:~ sssss$ /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java ; exit;
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32      use a 32-bit data model if available
    -d64      use a 64-bit data model if available
    -server   to select the "server" VM
                  The default VM is server,
                  because you are running on a server-class machine.


    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.

java ; java; exit; 出口;

You're telling it to exit after running java. 您要告诉它在运行Java后退出。 So it does. 确实如此。 I suggest you familiarize yourself with the shell, not just java. 我建议您熟悉外壳程序,而不仅仅是Java。

The exit; exit; at the end of your first line is logging you out of your terminal session. 在第一行末尾,您将退出终端会话。 Here are the cojure install docs for is: https://gist.github.com/rakhmad/2407109 以下是Cojure的安装文档: https ://gist.github.com/rakhmad/2407109

Hang on -- you're clicking the Java binary using the finder? 等等-您正在使用查找器单击Java二进制文件吗? Do I understand you correctly? 我能正确理解你的意思吗?

That's not how Java works. 那不是Java的工作方式。 It's a command line tool, not a graphical program. 它是命令行工具,而不是图形程序。 The help it's giving you is how you're supposed to call it. 它给您的帮助就是如何调用它。 Understanding this is non-trivial. 了解这一点并不容易。 If you don't know how to use the terminal window and command line, you're going to be decidedly unhappy. 如果您不知道如何使用终端窗口和命令行,那么您肯定会感到不满意。

But here's something I just did from Terminal: 但是,这是我刚刚从Terminal进行的操作:

$ cat Hello.java
    public class Hello {
        public static void main(String[] args) {
            System.out.printf("Hello, World!\n");
        }
    }
$ javac Hello.java
$ java Hello
Hello, World!

I use a $ as my command prompt, so each line that begins with a $ is a command in the terminal window. 我将$用作命令提示符,因此以$开头的每一行都是终端窗口中的命令。 So I cat'd the program (printed it out) -- it's 5 simple lines. 所以我把程序编入目录(打印出来)-这是5条简单的线。 I then used javac to compile it. 然后,我使用javac对其进行了编译。 I then used the java command to run it. 然后,我使用java命令运行它。

Maybe I misunderstood what you're doing, though. 不过,也许我误会了你在做什么。

Thanks guys! 多谢你们! I did a couple thing. 我做了两件事。 I changed my user as administer privilege and down load "Java for OS X 2015-001 https://support.apple.com/kb/DL1572?locale=en_US 我将用户更改为管理员权限并下载了“ Java for OS X 2015-001 https://support.apple.com/kb/DL1572?locale=zh_CN

It sorted all out :):) thanks! 它解决了所有:) :)谢谢!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM