Java — The selected directory is not a valid home for JDK

Java — The selected directory is not a valid home for JDK

Android Studio — IDE для разработки приложений для Андроид от Google на основе IntelliJ IDEA.

Установка:
Страница загрузок на официальном сайте.
Windows:
Необходимо установить JDK и прописать системную переменную JAVA_HOME

Перед первым запуском пропишите в переменную JAVA_HOME значение пути к текущей версии JDK (если не установлено, то установить JDK) — например C:\Program Files\Java\jdk1.7.0_21
P.S. Android Studio успешно запустилось на системе без переменной JAVA_HOME, где в PATH был прописан путь к JDK.

Чтобы использовать Android Studio с эмулятором на Windows XP SP3 необходимо скачать и установить старую версию Intel Hardware Accelerated Execution Manager (extra_intel_haxm-windows_r02.zip)

OS X:
Установка Andoid Studio на OS X намного проще — необходимо проинсталировать JDK, а затем Android Studio.

Не запускается эмулятор

Запускается эмулятор, но появляется ошибка «pixel launcher isn’t responding»

При запуске эмулятора лаунчер сообщает: Pixel launcher isn’t responding. Ни какой реакции на нажатия.

Произошло на машине с встроенной видеокартой Intel HD Graphics 3000 — в Windows 10 драйвер не поддерживает OpenGL (вероятно связанно с этим).
Решение: в наcтройках AVD установить значение Software-GLES 2.0 для Emulated performance\Graphics

Создание быстрого x86 эмулятора Android (AVD) на примере Android 5.0.1 (API 21)

Запускаем Android SDK Manager. Загружаем Intel x86 Atom System Image (ознакомьтесь также с Using Hardware Acceleration, Как разогнать эмулятор Android )

Пользуемся

Изменение места хранения AVD. Инструкция.
Проверено на Ubuntu 16.04, Android Studio 3.0, все компоненты обновлены до последней версии (на 19.11.2020)

  • Если подчеркивает красным код, где используются ресурсы: R
  • После внезапного выключения компьютера, после перезапуска может быть во всех проектах весь код красным
  • Если Android Studio выдает приблизительно такую ошибку: Error:Execution failed for task ‘:app:dexDebug’
  • В сообщении об ошибке упоминается heap — виртуальная память
  • Android Studio пришет примерно такую ошибку: Plugin is too old, please update to a more recent version, or set ANDROID_DAILY_OVERRIDE environment variable to «83648b99316049d63656d7276cb19cc7e95d70a5»
  • Иногда при подключении сторонних библиотек могут дублироваться некоторые файлы (обычно связанные с лицензированием). В сообщении будет что-то содержащее слова: duplicate files

  • Если при запуске эмулятора сообщение Cannot set up guest memory ‘pc.ram’: Invalid argument — проверьте в настройках эмулятора объем памяти, например установите 512 Мб.
  • Также быстро работает Android x86 в VirtualBox (Есть маркет в android-x86-4.2-20130228.iso)
  • Используйте в названиях файлов и каталогов только символы латинского алфавита.
  • Путь к файлу не должен превышать 256 символов.
  • Не используйте заглавные буквы — «Error:Execution failed for task ‘:app:mergeDebugResources’. Unsupported node ‘item’ in file «\powertool\app\src\main\res\menu\menu.xml» — была из-за заглавной буквы в «Menu» «

Учебники по Android Studio:

Renamed Properties in BuildTypes
runProguard => minifyEnabled
zipAlign => zipAlignEnabled
jniDebugBuild => jniDebuggable
renderscriptDebug => renderscriptDebuggable

Renamed Properties in ProductFlavors
flavorGroups => flavorDimensions
packageName => applicationId
testPackageName => testApplicationId
renderscriptSupportMode => renderscriptSupportModeEnabled
ProductFlavor.renderscriptNdkMode => renderscriptNdkModeEnabled

Т.е. например в build.gradle вместо runProguard false необходимо написать minifyEnabled true

Просьба: если вы автор последнего сообщения — просто редактируйте его, а не добавляйте новое.

Добавляем систему контроля версий Mercurial
Разработчики используют систему Mercurial для администрирования исходного кода. У нее два основных назначения:

  • Она хранит все предыдущие версии каждого файла
  • Она может объединить разные версии вашего кода, то есть сотрудники могут независимо работать над кодом и затем объединять свои изменения

О инсталляции и работе с Mercurial хорошо написано здесь:

  1. Hg Init: Часть 2. Основы Mercurial
  2. Hg Init: Часть 3. Привыкаем работать в команде

Устанавливаем Mercurial, если необходимо добавляем в %PATH% путь (в моем случае D:\Program Files\TortoiseHg\).
Запускаем в консоли из каталога проекта команду hg init — создает репозиторий.
Открываем проект в Android Studio — Studio обнаруживает Mercurial и предлагает добавить (add root).
Пользуемся — правая кнопка на вкладке открытого файла — Mercurial. Здесь те пункты, описанные в статье Hg Init: Часть 2. Основы Mercurial — Pull, Push, Commit и т.д.)

.

How to check if an ExecutionResult is empty in Neo4j

An execution result is essentially an iterator of a map, its type definition is something like: Iterable > So you can easily just do: result.iterator().hasNext(); I think that its strictly a ResourceIterator, so if you get an iterator you are supposed to close it if you don’t exhaust it. Check the.

Dynamic creation of objects vs storing them as fields

There won’t be any difference, since you’ve only changed the scope of the variables. Since you’re not using the variables outside of the scope, the generated bytecode will be identical as well (you can try it out with javap). So use the second style for clarity. Edit: In fact if.

Get element starting with letter from List

The indexOf method doesn’t accept a regex pattern. Instead you could do a method like this: public static int indexOfPattern(List list, String regex) < Pattern pattern = Pattern.compile(regex); for (int i = 0; i java,android,eclipse,adt

In your MainActivity.java at line no 34 you are trying to initialize some widget that is not present in your xml layout which you have set it in your setContentView(R.layout. That;s why you are geting nullpointerexception. EDIT: change your setContentView(R.layout.activity_main) to setContentView(R.layout.fragment_main).

Andro > java,android,string

Correct me if I’m wrong. If you’re saying that your code looks like this: new Thread(new Runnable() < public vo .

BitmapFont > java,android,libgdx

After the API 1.5.6 we have a different way to get the String bound. try this GlyphLayout layout = new GlyphLayout(); layout.setText(bitmapFont,»text»); float w >

Can I install 2 or more Andro > java,android,eclipse,sdk,versions

There shouldn’t be any problem if you use the latest SDK version ; actually, this is recommended. However, make sure to set the correct «Target SDK», i.e. the highest android version you have successfully tested your app with, and the «Minimum Required SDK» as well.

Interpreting hex dump of java > java,class,hex

The 000000b0 is not part of the data. It’s the memory address where the following 16 bytes are located. The two-digit hex numbers are the actual data. Read them from left to right. Each row is in two groups of eight, purely to asist in working out memory addresses etc.

@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) doesn’t work

deleteEmployee method is not wrapped into a new transaction because you are referencing method on this. What you can do is to inject reference to the facade itself and then call deleteEmployee method on it (it should be public). More or less something like this: @Stateless public class MyFacade <.

Get network interfaces on remote machine

No, we cannot by definition. The IP address is needed to hide the mac address from external world. To retrieve it you definitely need some code running on that machine. It means that you need some kind of agent. You can either implement it in Java or use platform specific.

A beginner questions about printf, java

I’m sad that this question hasn’t been answered, and upon that, I can’t upvote it from it’s -8 cause I don’t have enough reputation. It seems downvoting is getting too unwarranted here. OP is just looking for an answer, which can be answered here and found online, he has tried.

Mysterious claim of a missing < in eclipse

In Java, you cannot write executable statements directly in >

Finding embeded xpaths in a String

Use <> instead of () because <> are not used in XPath expressions and therefore you will not have confusions.

Java dice roll with unexpected random number

else < System.out.println(diceNumber); >You are printing the address of diceNumber by invoking its default toString() function in your else clause. That is why you are getting the [email protected] The more critical issue is why it gets to the ‘else’ clause, I believe that is not your intention. Note: In.

SOAP Client, Following an example

Actually you can generate class with soap ui. And your program can easily call the service using the class created without construct your own request header and body But you need some library. Example java jdk comes with jax-ws lib tutorial: http://www.soapui.org/soap-and-wsdl/soap-code-generation.html.

Andro > java,android,android-intent,uri,avd

Change your onClick method to below code. You should give the option to choose the external player. @Overr )); > .

Join files using Apache Spark / Spark SQL

If you use plain spark you can join two RDDs. let a = RDD > let b = RDD > RDD >> c = a.join(b) This produces an RDD of every pair for key K. There are also leftOuterJoin, rightOuterJoin, and fullOuterJoin methods on RDD. So you have to map both datasets to.

Javadoc: Do parameter and return need an explicit type description

No, there’s no need, the JavaDoc tool parses the Java code and gets the types from there. This article on the Oracle Java site may be useful: How to Write Doc Comments for the Javadoc Tool From the @param part of that article: The @param tag is followed by the.

Selenium catch popup on close browser

Instead of using driver.quit() to close the browser, closing it using the Actions object may work for you. This is another way to close the browser using the keyboard shortcuts. Actions act = new Actions(driver); act.sendKeys(Keys.chord(Keys.CONTROL+»w»)).perform(); Or, if there are multiple tabs opened in driver window: act.sendKeys(Keys.chord(Keys.CONTROL,Keys.SHIFT+»w»)).perform(); .

type conversion if flex

You try to cast data type mx.collections:IList to UI component type spark.components:List, which of course leads to exception. Try to follow the error message hint and use mx.collections:IList: screenList.addAll(event.result as IList); .

Get current latitude and longitude andro > java,android,gps,geolocation,location

See my post at http://gabesechansoftware.com/location-tracking/. The code you’re using is just broken. It should never be used. The behavior you’re seeing is one of the bugs- it doesn’t handle the case of getLastLocation returning null, an expected failure. It was written by someone who kind of knew what he was.

setOnClickListener error Null object

After super.onCreate(savedInstanceState); insert setContentView(R.layout.YourLayout); you need to make a request to a server in another thread. It might look like public class LoginTask extends AsyncTask < private String username; private String password; private Context context; public LoginTask(Context context, String username, String password) < this.username = username; this.password = password;.

Numeric literals in Java — octal? [duplicate]

-0777 is treated by the compiler as an octal number (base 8) whose decimal value is -511 (-(64*7+8*7+7)). -777 is a decimal number.

IntelliJ > Posted by: admin February 9, 2020 Leave a comment

I just installed IntelliJ IDEA and I’m trying to set it up. I’ve gotten to the part where I need to select my home directory for my JDK.

I tried navigating to my Java installation, C:\Program Files (x86)\Java , and clicked okay but it told me the message above. So, I tried C:\Program Files (x86)\Java\jre7 and that didn’t work either.

I tried reinstalling the latest JDK (from here) and I still couldn’t choose my JDK. I even dragged the .jar installer I got from the website and the file selector window wouldn’t recognize it.

I’m at a standstill and I don’t know what to do.

Because you are choosing jre dir. and not JDK dir. JDK dir. is for instance (depending on update and whether it’s 64 bit or 32 bit): C:\Program Files (x86)\Java\jdk1.7.0_45
In my case it’s 32 bit JDK 1.7 update 45

This error occurs because if you choosing the path deep in JDK or JRE.
The exact path that should be chosen is in my case 64 bit

C:\Program Files\Java\jdk1.8.0_91

C:\Program Files (86)\Java\jdk1.8.0_91

May be your jdk is in /usr/lib/jvm/. This variant for linux.

I had the same issue. But I figured it out by choosing this path:

First at all, you need to select the C:\ folder. Then, you select Program Files. After it, you select java, and finally the jdk you downloaded. In my case, I downloaded the JDK1.8.0_60 version.

To resume the path:

After you are done with it, you can click on the button next. Then you select the create project from templates. This will create a java application with a main() method. After it, you click next to create the name of you project.

I hope this helps you.

It got this error because I had managed to clobber jdk1.8.0_60 with the jre!

One thing we should note: the jdk should be installed on C: drive.

I had JDK installed on my D: drive like this:

And it would still give me the same error. For some reason Java should be installed on C: drive.

Andro >

Questions: I want to load Java classes dinamically on Android application. I have the .jar file and i can create the .dex file on that jar with command dx. Then, how can I use them to load in Android .

converting .prn file in to html page using java

Questions: how to convert .prn file in to html page using java. I am treating it as a text file and reading it line by line but thats quite cumbersome as each line requires its own splitting logic. As.

How can i only read Strings or Integers when i read .txt file with Scanner >

Questions: Hey guys this is my first question so if i have any mistakes or faults , i am sorry about that. So i am working on one thing which i’m currently keep failing of and that is ,as it say.

IntelliJ IDEA adding JDK 10: “The selected directory is not a valid home for JDK”

I’m creating this question only because the duplicate questions I found were marked with Windows and Ubuntu respectively, whereas I am experiencing this issue on macOS

I have IntelliJ Ultimate 2020.2 installed, with JDK 8 added, and want to add JDK 10. After downloading and installing Oracle’s JDK 10, and attempting to add /Library/Java/JavaVirtualMachines/jdk-10.0.1.jdk/Contents/Home as a new JDK to IntelliJ, I got the error message

The selected directory is not a valid home for JDK

despite the fact that the path and file permissions of this JDK 10 directory were seemingly all aligned with the JDK 8 ones.

1 answer

  • answered 2020-06-05 12:21 Anders Rabo Thorbeck

It turned out that upgrading to the newest IntelliJ IDEA version was (for some reason) what was required. After installing IDEA 2020.1, I was able to add JDK 10 without issue.

See also questions close to this topic

So, the instruction is to change the part that is changeable into a method, to be changed into a method. I can’t find any.

This is the line of code

I tried something but it doesn’t work. Any suggestion?

It seems that I haven’t fully understand methods. Do you guys have any good resources to learn about methods, or java in overall?

I’m currently studying in a Japanese university and I believe the language seems to be the biggest barrier for me to learn smoothly.

I just want to return the String but for some reason its not working, the Print its just a test to see if im calling the method the right way

When ever I abort a jenkins job chromedriver.exe doesn’t stop, it will continue to finish the full selenium script. I have to stop the process manually.

How can I overcome this, when I abort jenkins job it should also stop chromedriver.exe which is running in headless mode.

I am trying to run a timer triggered nodejs azure function locally on MAC (inside docker) but getting the following error:

And when I am trying to trigger the function using HTTP post I get the following error:

this is in my local.settings.json file:

Any help is appreciated.

After updating fastlane to the latest (2.135) and to mac Catalina 10.15.1 and Xcode 11.2.1 Screenshots in snapshot (also updated to latest) stopped working.

If I open the simulator, it gets stuck on my splash screen and it hangs

SnapshotUITests: SnapshotUITests-Runner.app encountered an error (Failed to install or launch the test runner. (Underlying error: The request to open «com.myapp.SnapshotUITests.xctrunner» failed. The request was denied by service delegate (SBMainWorkspace) for reason: Busy («Application failed preflight checks»). (Underlying error: The operation couldn’t be completed. Application failed preflight checks)))

Resetting simulators, updating devices, setting concurrent to false, reset mac and nothing helped.

I have an application running on one monitor on fullscreen mode, but when user open display preferences (from other monitor), the fullscreen mode will be ruined, how to avoid that? Some thoughts: 1. Is there any API which could deny user from opening Display Preference? 2. If fullscreen mode was pushed off by display preference window, does application get any notification? 3. When user open display preferences, is there any notification broadcast to application (Quartz APIs)?

T2 & T3 is for application to get the chance to switch back to fullscreen mode

I am writing (essentially) an N choose R method that should return a list of possible combinations. Intelli-J is telling me that my ArrayList which I am adding ArrayList to says that its returning a boolean type in the first if statement instead. And in the next few statements I am doing the same thing but it doesn’t show that I have any errors there. Here is my code (my recursion is probably wrong right now but I can’t test my methof until this error is fixed):

i went to preferences, Editor, Color Scheme, Language Defaults. In Keywords, i changed the color. Restart Intellij, but color didn’t change.

Any suggestions ? Thx !

Let’s look at the Navigation tool window — which defaults to the Left Top . I actually clicked on the gear icon/settings and selected Left Bottom instead:

Well as we can see the Navigation tool window is still in the upper left. So then

  • what is that Move to actually doing?
  • how can the Navigation tool window be moved to the bottom left?

Update: I tried this in Intellij and it did what I had expected:

In this case the setting was for Bottom right and it is exactly there. Is this a bug in Pycharm only?

Unfortunately, there is no item in Effective Java that discusses the reserved type name «var»(since it is introduced in java 10).

There is a saying to use interfaces as types whenever you can (Item 64: Refer to objects by their interfaces). But When using var :

var list = new ArrayList (); // infers ArrayList

( list is of type ArrayList )

Effective Java states It is a bad practice to refer to a variable by its implementation because It makes code dependent on it. This is just one annoyance I’ve found when starting to use var in my code.

Question:

Are there any best practices when using the reserved type name «var»? When should I use It? When should I avoid it?

I’m working on an assignment to calculate trajectory based on speed and angles and I’m getting a couple of errors in my calculation that I don’t understand how to fix. The program works like this: reads in values from a text file into 2 int arrays using nextInt() method. These arrays are passed to a class where the calculateTrajectory method and are combined into a 2D array. These are all int arrays. In the calculateTrajectory, after combining into a 2D array, I then calculate the trajectory, but get errors in my caclulation.

Descriptions of the errors I’m getting:

As I’m looping through the 2D array to do my calculation, I’m getting one error when using the Math.pow method on my speed value. That error says «the method pow(double, double) in the type Math is not applicable for the arguments (int[], int)». The advice is to change type of speed to double. Do I need to cast the values to doubles?

The second error in the calculation comes when I try to multiply angles by 2 inside the toRadians. The error I get here is «The operator * is undefined for the argument type(s) int, int[]». There is no quick fix advice here. I’ve looked up this error and any answers I’ve seen are really confusing.

I’ve tried making my arrays double arrays with no avail. I’m wondering if I can cast the values of the int arrays into doubles when I populate my 2D array, if that will solve the problem.

I know, based on the equation, that I will get doubles as a result of the calculation. The variable that I’ve set up to take the result of the calculation is a double. I want to be able to run the calculation without the errors, while looping through and populating my trajectoryArray with the results.

I have a requirement to read excel file in java without using any third party library jar like POI,JEXCEL .I don’t know exactly can spring support for same? Please suggest if you know something.

Thanks in advance

Using POI I have done but read without using any jar

Цукерберг рекомендует:  Швартовка элементов с помощью jQuery
Понравилась статья? Поделиться с друзьями:
Все языки программирования для начинающих