简体   繁体   English

从java.home查找Mac和Linux上的Jre文件

[英]Finding the Jre file on Mac and Linux from java.home

I was able to invoke Java from within Java on Windows from (java.home)/bin/java. 我能够从(java.home)/ bin / java在Windows上的Java中调用Java。 But I tried the same code on a Mac, and it didn't work. 但是我在Mac上尝试了相同的代码,但是没有用。 I presume it wouldn't work on Linux either. 我猜想它也不能在Linux上运行。 What file within java.home do I need to invoke to launch java on Mac and Linux? 我需要调用java.home中的哪个文件才能在Mac和Linux上启动Java?

same command to invoke java "java" . 相同的命令来调用java“ java”。 But first verify that java is installed in your Mac or Linux. 但是首先请确认您的Mac或Linux中已安装Java。 Use following command and see what you get 使用以下命令,看看会得到什么

user@ubuntu:~$ which java
/usr/bin/java
user@ubuntu:~$ ll /usr/bin/java
lrwxrwxrwx 1 root root 22 Jul 26 21:54 /usr/bin/java -> /etc/alternatives/java*
user@ubuntu:~$ ll /etc/alternatives/java
lrwxrwxrwx 1 root root 30 Aug 15 12:43 /etc/alternatives/java -> /usr/lib/jvm/jdk1.7.0/bin/java*

You just need to invoke java . 您只需要调用java There is no need to type anything in front of it. 无需在其前面键入任何内容。

By the way, there is no need to type anything in front of java on Windows either. 顺便说一句,在Windows上也不需要在java前面键入任何内容。 You can set your PATH environment variable to point to your java.home directory. 您可以将PATH环境变量设置为指向java.home目录。

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

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