Forum Discussion
How to introduce Java commands into PowerShell on Linux platform.
As shown in the following figure, I can't use Java commands in PowerShell on Linux platform. How to set PowerShell to use Java commands on Linux platform.
fsq2018 The Java program is perhaps not in your path? If you do a write-host $env:PATH, what does it show you? If the path in which Java is located is missing, then you can add it to your Powershell profile by running nano $profile and adding and restart PowerShell to load the adjusted profile:
$env:Path += "/path/to/java"
I think the path should be in your ~/.bash_profile as JAVA_HOME?
fsq2018 The Java program is perhaps not in your path? If you do a write-host $env:PATH, what does it show you? If the path in which Java is located is missing, then you can add it to your Powershell profile by running nano $profile and adding and restart PowerShell to load the adjusted profile:
$env:Path += "/path/to/java"
I think the path should be in your ~/.bash_profile as JAVA_HOME?
- fsq2018Copper ContributorThank you for your reply. I tried $env: path and found that there was no Java path,
while in my ~/.bash_profile file, there is a Java pathThen I modified the powershell profile file$env:path+="/home/fang/.jdk/bin"
then I finally found that it work out.- In Windows it automatically takes the path settings into the powershell session, in Linux it's different so it seems. Good to hear that this works