Error: JAVA_HOME is not set and no java command could be found in your PATH IntelliJ

시리즈

1.[오류]Gradle refresh

jsp설정을 위한 의존성 추가 후 저장 - buildgradle우클릭 - refresh gradle project.하니 x가 사라졌다.

2021년 5월 17일

6.[오류]oracle.jdbc.OracleDriver

1>oracle.jdbc.OracleDriver2>데이터 소스 빈등록 안됨?데이터베이스 연결이 안되어서 저번에는 jar파일을 알집 풀어서 넣었다가 안됬었는데 이번에는 넣는 것을 아예 안함.알집그대로 ojdbc6.jar 파일을webapp-WEB-INF-lib 폴더에 복사

2021년 5월 23일

8.[오류]css오류, config설정확인

Spring securtiy 진행 중 부트스트랩에서 css소스 다운 받아서 사용했는데 적용되지가 않았음.config설정 수정하다가 css부분 지워서 그랬음config에 설정에 로 수정함.antMatchers()는 특정한 경로를 지정.permitAll()는 모든 사용자가

2021년 5월 31일

9.[오류]User오류 임포트 잘못함

경고문 떠서 클릭하니컨트롤러로 이동됨, user에 빨간줄이 있었음해당 에러메세지컨트롤러에서 User임포트를 잘 못해줬음내가 생성한 model User를 임포트해야함.

2021년 5월 31일

11.[오류]마리아db데이터연결오류,테이블명 오타였음

Maven spring security진행 중 등록창에서 아이디와 패스워드 입력하면 그 내용이 저장되어야한다. 문제: 서버는 돌지만 입력 후 500에러메세지 발생 원인: 테이블에서 user_role을 찾지 못함, 마리아디비 데이블 확인 결과 오타가 나 있었음.user

2021년 5월 31일

12.[오류]404인데 모든페이지가 안됨

이전에는 한 페이지만 안 되었다 이럴경우 단순 매핑 문제로 간단히 해결되었다. 오늘은 전부 안 되고 , 내가 친 url이 사라지기까지 함. 로컬주소/account/login으로 하는데 엔터 후 /login으로 자동으로 바뀌고 404페이지로 넘어감 ![](//images.velog.io/images/dbal9357/post/3b04a550-d46...

2021년 5월 31일

13.[오류]주석 때문에 500나왔었음

ex2가 받아서 데이터를 조립해서 뿌려줄꺼임 dto라는 변수로 list를 받아옴 타임리프 공부하다가... ... 하 너무 화났는데ㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋㅋ 막 갑자기 그래들 설정 다시하라는 안내도 계속뜨고 파일 받아서 열었는데 난 안되고 근데 주석 지우니 싹

2021년 6월 9일

14.[오류] Thymeleaf 이미지 삽입 오류

파일 위치가 컨피그 권한이랑 다르게 되어있어 못 찾은 것이였음. ![](//images.velog.io/images/dbal9357/post/9dd4ce1e-d658-4ea2-966d-c79be8c461ae/%EC%9D%B4%EB%AF%B8%EC%A7%80

2021년 6월 10일

Issue

I've followed step by step the official Getting Started. I started from a clean linux install and installed everything required as per the "Building Projects with Native Code" tab. I have also read the troubleshooting section. I've already created the project using the terminal.

This is the error when I run react-native run-android:

Starting JS server... Building and installing the app on the device (cd android && ./gradlew installDebug)... ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the location of your Java installation. Could not install the app on the device, read the error above for details. Make sure you have an Android emulator running or a device connected and have set up your Android development environment: //facebook.github.io/react-native/docs/android-setup.html

It does not find JAVA_HOME because the latest versions of Android Studio don't require Java to be installed in the system. Instead an internal JRE is used.

Duplicate disclaimer: I've already read this question. This is not what I want. I know how to set the Java home. I just want to run the react project WITHOUT having to install a separate Java.

Questions:

  1. How could I find the internal Java inside the Android Studio folder so that I could point JAVA_HOME to it?
  2. If not possible, could I open and run the project inside the android folder with Android Studio? How would I refresh this project after modifying the React JavaScript code in the parent folder?

Solution

I'll answer my own questions and sponfeed my fellow linux users:

1- To point JAVA_HOME to the JRE included with Android Studio first locate the Android Studio installation folder, then find the /jre directory. That directory's full path is what you need to set JAVA_PATH to (thanks to @TentenPonce for his answer). On linux, you can set JAVA_HOME by adding this line to your .bashrc or .bash_profile files:

export JAVA_HOME=<Your Android Studio path here>/jre

This file (one or the other) is the same as the one you added ANDROID_HOME to if you were following the React Native Getting Started for Linux. Both are hidden by default and can be found in your home directory. After adding the line you need to reload the terminal so that it can pick up the new environment variable. So type:

source $HOME/.bash_profile

or

source $HOME/.bashrc

and now you can run react-native run-android in that same terminal. Another option is to restart the OS. Other terminals might work differently.

NOTE: for the project to actually run, you need to start an Android emulator in advance, or have a real device connected. The easiest way is to open an already existing Android Studio project and launch the emulator from there, then close Android Studio.

2- Since what react-native run-android appears to do is just this:

cd android && ./gradlew installDebug

You can actually open the nested android project with Android Studio and run it manually. JS changes can be reloaded if you enable live reload in the emulator. Type CTRL + M (CMD + M on MacOS) and select the "Enable live reload" option in the menu that appears (Kudos to @BKO for his answer)

Answered By - Mister Smith

Toplist

Neuester Beitrag

Stichworte