Java version determination error - java

I just install Android Studio 1.5 on Ubuntu 14.04. I created a new project and I get the following error:
Error:Could not determine Java version using executable /usr/lib/jvm/java-1.5.0-gcj/bin/java.
My /usr/lib/jvm/ contain:
java-1.5.0-gcj java-7-oracle java-gcj
java-1.5.0-gcj-4.8-amd64 java-8-oracle java-gcj-4.8
The Project Structure has the JDK location set up to /usr/lib/jvm/java-1.5.0-gcj. Should it me something else ? How can I know ?
Many thanks for you help !

I solved my problem by simply changing the JDK to /usr/lib/jvm/java-8-oracle. I still don't know why it works, or why it should have been like this at the first place.
Sorry for the question.

The problem occurred because location of the JDK directory was not defined correctly.
In Android studio File ->Project structure ->in left side tabs click on SDK location->define the directory where JDK is located .
For example:/usr/lib/jvm/java-8-oracle/jdk1.8.0_77 is my directory of JDK.The location can be different.

Another variant:
Replace homePath value in ~/.AndroidStudio1.5/config/options/jdk.table.xml on /usr/lib/jvm/java-8-oracle/bin/java

Related

The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe" is invalid

Ok im wondering where does xamarin get this path from?
Severity Code Description Project File Line Source Suppression State
Error The specified task executable location "C:\Program Files (x86)\Java\jdk1.7.0_71\\bin\javac.exe" is invalid.
So I can go and change it to the new jdk1.8. I have the new JDK set up I just need to know where to change the path at.
I had the same problem and solution is.
Remove all jdk and install jdk 1.8
Change reference java location in Visual Studio Tool > Options > Xamarin
Clean and Rebuild Project
I've just solved this exact problem for me.
I don't know why you wouldn't have a JDK_HOME variable. Completely remove the JDK and install it again maybe?
The Environment Variables for java were set to my previously installed path. I guess Oracle screwed up here.
As I had the same error, here's what I did:
I went to C:\Program Files\Java\ and checked what the jdk folder is called. For me it's jdk1.8.0_102.
For users who don't know where to find System Variables:
Go to System Properties and on the left hand side, click Advanced System Settings. Switch to the Advanced tab, click Environment Variables. Under System Variables there should be two variables in the list called JAVA_HOME and JDK_HOME.
I edited those values and change the path to what I found in the java folder. In my case this would be C:\Program Files\Java\jdk1.8.0_102.
No need to close VS, just build your app and it should get passed the annoying error.
Hope this helps :)
I had exactly the same problem. I got it to go away (which is not the same thing as fixing it).
Un-install every bit of JAVA you have. Delete both JAVA folders (Program Files and Program Files (x86)).
Install the latest version of the Java (x32) SDK.
Clean and Rebuild your project(s).
Since my Solution is multi-platform, I changed the Startup Project to the .iOS one, built it, ran it in an emulator, and set the Startup Project back to the .Droid project.
Somewhere in all this, the problem went away.
And remember kids! If it can go away all by itself, it can come back again all by itself!
I had this issue as well, I downloaded 32 bit Java but VS was still looking for the 64 bit one.
To solve it all I had to do was change the JAVA_HOME and the variable in my Path, clean my project and rebuild it.
Just set JAVA_HOME and JDK_HOME ambient variables, clean your solution and build again. For me worked fine.
Don't forget to clean your solution.

Error: Module not specified (IntelliJ IDEA)

I was trying to execute a simple program in IntelliJ IDEA as a static web project. I'm newbie and I'm learning web development with Node.js. I took help from the official website of IntelliJ IDEA, but the error was same. Though, I configured the settings and Project structure also.
Error:
"C:\Program Files\Java\jdk1.8.0_91\bin\java" -Didea.launcher.port=7535 "-Didea.launcher.bin.path=C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2016.1.2\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain ""
Exception in thread "main" java.lang.ClassNotFoundException:
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:122)
Process finished with exit code 1
Snapshot of IDE
Please help me to sort out this problem. I'm digging out this problem since few days.
This is because the className value which you are passing as argument for forName(String className) method is not found or doesn't exists, or you a re passing the wrong value as the class name. Here is also a link which could help you.
1.
https://docs.oracle.com/javase/7/docs/api/java/lang/ClassNotFoundException.html
2.
https://docs.oracle.com/javase/7/docs/api/java/lang/Class.html#forName(java.lang.String)
Update
Module not specified
According to the snapshot you have provided this problem is because you have not determined the app module of your project, so I suggest you to choose the app module from configuration. For example:
this is how I fix this issue
1.open my project structure
2.click module
3.click plus button
4.click import module,and find the module's pom
5.make sure you select the module you want to import,then next next finish:)
For IntelliJ IDEA 2019.3.4 (Ultimate Edition), the following worked for me:
Find the Environment variables for your project.
Specify, from the dropdowns, the values of "Use class path of module:" and "JRE" as in the attached screenshot.
I faced the exact issue of module not found and solved it by navigating to pom.xml file in file system of my project and opening it as a maven project in my intelliJIdea.
Then it has populated the sub modules for selection in the edit configurations window.
Faced the same issue. To solve it,
I had to download and install the latest version of gradle using the comand line. $ sdk install gradle using the package manager or $ brew install gradle for mac. You might need to first install brew if not yet.
Then I cleaned the project and restarted android studio and it worked.
This happened to me when I started to work with a colleque's project.
He was using jdk 12.0.2 .
If you are suspicious jdk difference might be the case (Your IDE complains about SDK, JDK etc.):
Download the appropriate jdk
Move new jdk to the folder of your choice. (I use C:\Program Files\Java)
On Intellij, click to the dropdown on top middle bar. Click Edit Configurations. Change jdk.
File -> Invalidate Caches and Restart.

Tesseract OCR Build Issue on Windows

I have Windows 8.1, Android Studio and NDK installed.
I am making an OCR android app and following this tutorial
http://www.codeproject.com/Tips/840623/Android-Character-Recognition
I am facing a problem at building the project.
I updated my PATH in System Variables to
“C:\Program Files\Java\jdk1.8.0_25\bin;D:\Softwares\Studies\Android\android-sdk\tools;D:\Softwares\Studies\Android\android-ndk-r10d”
And then first I executed “ndk-build” command on DOS which executed successfully and then when I executed this command
“android update project --path D:\Softwares\Studies\Android\OCR\Code_Project\tess-two-master\tess-two”
I got this error:
“ `'xcopy' is not recognized as an internal or external command, operable program or batch file`.
Error:
The project either has no target set or the target is invalid.
Please provide a --target to the 'android.bat update' command.
”
I ve searched all over the internet but could not find the solution, can you please help me with this?
Thanks
I have searched the whole internet and could not find a single place where the proper ans is given.
This had basically two parts:
i) "xcopy" is not recognized
ii) The project either has no target set or the target is invalid.
Please provide a --target to the 'android.bat update' command.
The first part part can be solved by any of the two ways:
i) Moving xcopy.exe file from Windows/System32 folder to android-sdk\tools folder OR
ii) Adding %SystemRoot%\system32 to PATH in System Variables in Environment Variables. The PATH must contain android-sdk\tools;android-ndk-r10d;%SystemRoot%\system32 at least.
Now comes the second part. Enter this command:
android update project --path (location of tess-two folder) --target android-19 (19 is the API level here and may vary)
for e.g. android update project --path D:\Softwares\Studies\Android\OCR\Code_Project\tess-two-master\tess-two --target android-19
THAT'S IT. Hope it is clear even to someone who is very new. :)
Ps. If you find it useful, please do vote up, I am new and need reputations. :)
This blogpost has a elaborate description on how to build tesseract on Windows using Eclipse.

No LeapJava in java.library.path

I'm encountering a problem with the build of my JavaFX project with the Leap Motion.
When I run the file.jar, the application's window is opening, but when I call the leap motion, it's not working any more.
I have the following error :
Native code library failed to load.
java.lang.UnsatisfiedLinkError: no LeapJava in java.library.path
Yet, I have configured the buildpath. I have added the leapJava.jar, with the native library x64.
I don't understand why it doesn't work ?
Anyone with an idea ?
Thanks
The LeapJava.dll is missing or the Java library path is not set up correctly. Please have a look at the docs - setting up a project:
https://developer.leapmotion.com/documentation/java/devguide/Project_Setup.html
I have followed each step in the Eclipse section. :/
Firstly, since you haven't mentioned any specification about your system, I am answering this in context with a 64 bit Ubuntu machine.
You will posses a libLeap.so and a libLeapJava.so in 'YourDeveloperKitDirectory'/LeapSDK/lib/x64/ . These files should be copied to your /usr/lib and the configuration/bulid path (if using IntelliJ IDE -> 'Edit Configurations'->'Application'->'configuration'->'VM options'->"-Djava.library.path=/usr/lib") should be appropriately stated.
Save and run your application.
I had this problem, what solved it was adding -Djava.library.path=/Path/to/LeapDeveloperKit_2.3.1+31549_mac/LeapSDK/lib to the command line call for the .jar file. (make sure your developer kit is the right version)
So rather than:
java -jar leapMotionProgram.jar
It had to be:
java -jar -Djava.library.path=/Path/to/LeapDeveloperKit_2.3.1+31549_mac/LeapSDK/lib leapMotionProgram.jar

Android Studio - supplied javaHome is not a valid folder

I decided to update my JDK to Java 8, and installed to the default location of C:\Program Files\Java\jdk1.8.0 with a jre subdirectory.
I wasn't sure how Android Studio worked out the JDK location, so I decided to launch it and see. I got the following message:
Failed to complete Gradle execution.
Cause:
Supplied javaHome is not a valid folder. You supplied: C:\Program Files\Java\jdk1.7.0_45
I updated my JAVA_HOME environment variable (both for system and user) to point to the new path, and tried adding it to my PATH variable as well, but every time I attempt to build in Android Studio I get the same message. The quoted path is nowhere to be found in my environment variables though, so where is it getting it from and how can I change it?
Thanks
The problem was my project's JDK location. From the Android Studio Project tool window, I right clicked on the root directory, selected 'module settings', and set the JDK location. Everything's fine now.
I don't know why or how this problem occurred but this answer got me over the hump. On macOS rm -rf ~/.gradle to wipe out the cache then restart Android Studio. I tried everything else up to and including reinstalling the JDK and Android Studio. Wiping out the .gradle directory is the only thing that worked.
Try to delete all .iml files and .idea, and re-import the project from Gradle. Worked for me (provided you have everything else set up).
This error happens when you switch from Intellij to Android Studio, or the other way around, and load the same project. Looks like their project model is not compatible.
For Android Studio 1.1.0, after right-clicking on the project:
Select Open Module Settings
Select SDK Location at top left
Type text into JDK Location: box
I ran into the same issue. My jdk was upgraded from a 1.8.0_172 to 1.8.0_202. And I kept getting the mentioned error although I changed to the right jdk, in the module configurations. What confused me was the fact that the API version was stamped with the old *_172 version in the dropdown of available project sdk's. I found the reason for this to be an old obsolete entry in the dropdown that referenced the old *172. After deleting this entry, the APi versions was magically stamped with the new version.
Note to self: Remember to sanitize your projects when new versions come along
I was also seeing this same problem. For me the fix was in 'Run/Debug Configurations' (Run > Edit Configurations...)
The 'Gradle project' value was set to the build.gradle file location, and this should've been set to the Gradle project object in IDEA, click the folder looking icon not the '...'.
I'm in 1.0.2 and after I clicked OK, it immediately opened a dialog to allow me to specify the location for my project, no longer requiring navigation of the menus to edit the project JDK path.
Definitely strange that during install, it says the JAVA_HOME environment variable is set to a path that doesn't contain the JDK. After spending time fixing it (downloading the full 64 bit JDK), I create my first project and get the same thing. Because it's not using the environment variable that it hinges on during setup.
Odd behavior.
For some reason I failed using all the above answers, so what I did is to delete (actually moved, so that I could go back in case something goes wrong) the ".idea" folder from the project. Then I opened the IDE again, and it went fine.
Getting this in 2021? Try to to rm -rf ~/.gradle and restart Android studio.

Categories

Resources