Could not find Java jdk in a directory that has been renamed
I am trying to built a React Native app using Ubuntu 16.04. When I try to run npm run android
in the terminal I get this error ERROR: JAVA_HOME is set to an invalid directory: /home/duong/git/Java/jdk1.8.0_144
The weird thing is that I have renamed my "git" folder to "admin" a while ago, and I also have deleted the Java directory in there also. How come npm sees the folder and not me? So now I don't know where the Java jdk is in my system. How can I retrieve the Java folder and set it to default location?
16.04 java jdk android-studio npm
add a comment |
I am trying to built a React Native app using Ubuntu 16.04. When I try to run npm run android
in the terminal I get this error ERROR: JAVA_HOME is set to an invalid directory: /home/duong/git/Java/jdk1.8.0_144
The weird thing is that I have renamed my "git" folder to "admin" a while ago, and I also have deleted the Java directory in there also. How come npm sees the folder and not me? So now I don't know where the Java jdk is in my system. How can I retrieve the Java folder and set it to default location?
16.04 java jdk android-studio npm
1
Presumably you originally setJAVA_HOME
to/home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as~/.bashrc
) and forgot to change it when you renamed the directory?
– steeldriver
Jun 22 '18 at 1:01
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
WellJAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself
– steeldriver
Jun 23 '18 at 15:08
add a comment |
I am trying to built a React Native app using Ubuntu 16.04. When I try to run npm run android
in the terminal I get this error ERROR: JAVA_HOME is set to an invalid directory: /home/duong/git/Java/jdk1.8.0_144
The weird thing is that I have renamed my "git" folder to "admin" a while ago, and I also have deleted the Java directory in there also. How come npm sees the folder and not me? So now I don't know where the Java jdk is in my system. How can I retrieve the Java folder and set it to default location?
16.04 java jdk android-studio npm
I am trying to built a React Native app using Ubuntu 16.04. When I try to run npm run android
in the terminal I get this error ERROR: JAVA_HOME is set to an invalid directory: /home/duong/git/Java/jdk1.8.0_144
The weird thing is that I have renamed my "git" folder to "admin" a while ago, and I also have deleted the Java directory in there also. How come npm sees the folder and not me? So now I don't know where the Java jdk is in my system. How can I retrieve the Java folder and set it to default location?
16.04 java jdk android-studio npm
16.04 java jdk android-studio npm
asked Jun 22 '18 at 0:55
dennievndennievn
1
1
1
Presumably you originally setJAVA_HOME
to/home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as~/.bashrc
) and forgot to change it when you renamed the directory?
– steeldriver
Jun 22 '18 at 1:01
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
WellJAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself
– steeldriver
Jun 23 '18 at 15:08
add a comment |
1
Presumably you originally setJAVA_HOME
to/home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as~/.bashrc
) and forgot to change it when you renamed the directory?
– steeldriver
Jun 22 '18 at 1:01
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
WellJAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself
– steeldriver
Jun 23 '18 at 15:08
1
1
Presumably you originally set
JAVA_HOME
to /home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as ~/.bashrc
) and forgot to change it when you renamed the directory?– steeldriver
Jun 22 '18 at 1:01
Presumably you originally set
JAVA_HOME
to /home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as ~/.bashrc
) and forgot to change it when you renamed the directory?– steeldriver
Jun 22 '18 at 1:01
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
Well
JAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself– steeldriver
Jun 23 '18 at 15:08
Well
JAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself– steeldriver
Jun 23 '18 at 15:08
add a comment |
2 Answers
2
active
oldest
votes
I've encountered this problem on my Ubuntu 18.04 and this link helped me out.
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
:D
New contributor
add a comment |
Try ls /home/duong/git/Java/jdk1.8.0_144
Does that dir exist?
You say you renamed the "git" folder to "admin".
Try ls /home/duong/admin/Java/jdk1.8.0_144
Does that dir exist?
Do you have Java installed from a .deb package from the repository?
Try
foo@bar:$ which java
/usr/bin/java
foo@bar:$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Oct 21 2016 /usr/bin/java -> /etc/alternatives/java
foo@bar:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Sep 15 19:03 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
foo@bar:$
The system wide install creates the many symlinks seen above. Following these will show you the directory in which java is installed. In the example directly above this is /usr/lib/jvm/java-11-openjdk-amd64
When you find your java install directory, set that as JAVA_HOME
E.g.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
or
export JAVA_HOME=/home/duong/admin/Java/jdk1.8.0_144
or whatever directory in which your java is installed.
Then run your npm
command.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1048698%2fcould-not-find-java-jdk-in-a-directory-that-has-been-renamed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I've encountered this problem on my Ubuntu 18.04 and this link helped me out.
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
:D
New contributor
add a comment |
I've encountered this problem on my Ubuntu 18.04 and this link helped me out.
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
:D
New contributor
add a comment |
I've encountered this problem on my Ubuntu 18.04 and this link helped me out.
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
:D
New contributor
I've encountered this problem on my Ubuntu 18.04 and this link helped me out.
http://tipsonubuntu.com/2016/07/31/install-oracle-java-8-9-ubuntu-16-04-linux-mint-18/
:D
New contributor
New contributor
answered 2 hours ago
J.JohnJ.John
1
1
New contributor
New contributor
add a comment |
add a comment |
Try ls /home/duong/git/Java/jdk1.8.0_144
Does that dir exist?
You say you renamed the "git" folder to "admin".
Try ls /home/duong/admin/Java/jdk1.8.0_144
Does that dir exist?
Do you have Java installed from a .deb package from the repository?
Try
foo@bar:$ which java
/usr/bin/java
foo@bar:$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Oct 21 2016 /usr/bin/java -> /etc/alternatives/java
foo@bar:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Sep 15 19:03 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
foo@bar:$
The system wide install creates the many symlinks seen above. Following these will show you the directory in which java is installed. In the example directly above this is /usr/lib/jvm/java-11-openjdk-amd64
When you find your java install directory, set that as JAVA_HOME
E.g.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
or
export JAVA_HOME=/home/duong/admin/Java/jdk1.8.0_144
or whatever directory in which your java is installed.
Then run your npm
command.
add a comment |
Try ls /home/duong/git/Java/jdk1.8.0_144
Does that dir exist?
You say you renamed the "git" folder to "admin".
Try ls /home/duong/admin/Java/jdk1.8.0_144
Does that dir exist?
Do you have Java installed from a .deb package from the repository?
Try
foo@bar:$ which java
/usr/bin/java
foo@bar:$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Oct 21 2016 /usr/bin/java -> /etc/alternatives/java
foo@bar:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Sep 15 19:03 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
foo@bar:$
The system wide install creates the many symlinks seen above. Following these will show you the directory in which java is installed. In the example directly above this is /usr/lib/jvm/java-11-openjdk-amd64
When you find your java install directory, set that as JAVA_HOME
E.g.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
or
export JAVA_HOME=/home/duong/admin/Java/jdk1.8.0_144
or whatever directory in which your java is installed.
Then run your npm
command.
add a comment |
Try ls /home/duong/git/Java/jdk1.8.0_144
Does that dir exist?
You say you renamed the "git" folder to "admin".
Try ls /home/duong/admin/Java/jdk1.8.0_144
Does that dir exist?
Do you have Java installed from a .deb package from the repository?
Try
foo@bar:$ which java
/usr/bin/java
foo@bar:$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Oct 21 2016 /usr/bin/java -> /etc/alternatives/java
foo@bar:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Sep 15 19:03 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
foo@bar:$
The system wide install creates the many symlinks seen above. Following these will show you the directory in which java is installed. In the example directly above this is /usr/lib/jvm/java-11-openjdk-amd64
When you find your java install directory, set that as JAVA_HOME
E.g.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
or
export JAVA_HOME=/home/duong/admin/Java/jdk1.8.0_144
or whatever directory in which your java is installed.
Then run your npm
command.
Try ls /home/duong/git/Java/jdk1.8.0_144
Does that dir exist?
You say you renamed the "git" folder to "admin".
Try ls /home/duong/admin/Java/jdk1.8.0_144
Does that dir exist?
Do you have Java installed from a .deb package from the repository?
Try
foo@bar:$ which java
/usr/bin/java
foo@bar:$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 Oct 21 2016 /usr/bin/java -> /etc/alternatives/java
foo@bar:$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 43 Sep 15 19:03 /etc/alternatives/java -> /usr/lib/jvm/java-11-openjdk-amd64/bin/java
foo@bar:$
The system wide install creates the many symlinks seen above. Following these will show you the directory in which java is installed. In the example directly above this is /usr/lib/jvm/java-11-openjdk-amd64
When you find your java install directory, set that as JAVA_HOME
E.g.
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
or
export JAVA_HOME=/home/duong/admin/Java/jdk1.8.0_144
or whatever directory in which your java is installed.
Then run your npm
command.
answered 1 hour ago
jason120jason120
11
11
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1048698%2fcould-not-find-java-jdk-in-a-directory-that-has-been-renamed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Presumably you originally set
JAVA_HOME
to/home/duong/git/Java/jdk1.8.0_144
in one of your shell initialization files (such as~/.bashrc
) and forgot to change it when you renamed the directory?– steeldriver
Jun 22 '18 at 1:01
Yeah so I edited the bashrc file to a new path. When I run 'echo $JAVA_HOME' I get the output '/usr/lib/jvm/java-8-oracle'. But when I typed just '$JAVA_HOME' I get this error instead.. 'bash: /usr/lib/jvm/java-8-oracle: No such file or directory '
– dennievn
Jun 23 '18 at 14:56
Well
JAVA_HOME
won't be an executable file, it will be a directory - unfortunately I can't tell you where you installed it, you will need to figure that out yourself– steeldriver
Jun 23 '18 at 15:08