I've been working on Aptana Studio and some JRE required software for a bit of time now , but since yesterday something quite odd happened, as suddenly the software that requires it threw me an error No Java virtual machine was found . Last thing I did before that was restoring my system files permissions thought safe mode as I had some trouble with that , could this have anything to do with it ?
I've tried installing JRE once again , no results. However when I run
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -version
I do get the following
java version "1.7.0_55"
Java(TM) SE Runtime Environment (build 1.7.0_55-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.55-b03, mixed mode)
Aptana gives me the following error
No Java virtual machine
was found after searching the following locations:
/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java
java in your current PATH
And other software such as Spine won't simply start.
My .bash_profile is the following :
PATH="/Library/Frameworks/Python.framework/Versions/3.4/bin:${PATH}"
PATH="/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:${PAT$
export PATH
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
The output of echo $PATHis the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/bin:/Library/Frameworks/Python.framework/Versions/3.4/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin
The output of echo $JAVA_HOME is the following
/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home
And Java invocations on the terminal work.
Guidance will be highly appreciated.
After trying Peter's suggestion the problem persisted but now in another context : "/System/Library/Frameworks/JavaVM.framework" does not contain the JNI_CreateJavaVM symbol"
After struggling for many hours, and reading about people with the same issue opting to re-install the entire OS , decided to examine the issue from another perspective, the thing I first mentioned here that I believe went unnoticed was that I restored my permissions before this happening, so what I did was the following.
After reading a bunch of articles about Apple no longer providing Java support themselves but Oracle providing it, reasoned through it and realized that perhaps paths (Often called directories) from Apple's final Java release may have not been strictly the same as the new Oracle releases, so decided to wipe out all recent Oracle Java Runtime Environment that I found on /Library/Java/JavaVirtualMachines and delete the Java Applet Plugin from /Applications (Just search for it on your /Applications path) .
Installed Apple's last stable release from the following link.
Located where Apple located their Java releases : /System/Library/Frameworks/
My particular interest was the Java Runtime Environment , so I explored the JavaVM directory on /System/Library/Frameworks/
Found out that all Apple's JRE previous releases reside on a directory called Versions that is within /System/Library/Frameworks/JavaVM.framework directory, here's where I noticed something rare, for some reason at the moment I restored file permissions from my Disk Utility Application , this directory was made inaccessible (By not giving the root user permissions to access anything in itself).
Went to my terminal console and inside the JavaVM.framework directory modified the permissions to that directory to be accessible for all users by running the following command chmod -R 777 Versions.
After executing these actions I went straight to my JRE-Required software and attempted to open it , success!
Things to learn from the issue.
Oracle's Java JDK/JRE are located in different paths from Apple's. (If you are struggling with some other issue, verify your Java version to determine your Java installation directory)
Apple's disk utility application might define different permissions than expected for some files. (After restoring permissions verify that everything's working fine, if not this may be the cause of your problems.)
Looks like AptanaStudio (Eclisebased right?) assumes that you have a JRE inside the Aptana directory (/Applications/Aptana Studio 3/AptanaStudio3.app/Contents/MacOS/jre/bin/java)
I assume that there is nothing there. Simplest way would be to symlink your existing JRE installation to that directory:
ln -s /Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre /Applications/Aptana\ Studio\ 3/AptanaStudio3.app/Contents/MacOS/jre
Or you could start Aptana from the terminal and specify the path to java with -vm:
./aptana -vm "/path/to/java/bin/directory"
Environment variables that must be available to GUI applications are a bit tricky in OsX (at least in my experience).
It is possible to set global PATH (and other variables) in /etc/launchd.conf, see for example here and /etc/paths.d see here.
Simple Solution
For Windows:
1.download the JAVA runtime environment x86(32bit) version else you will get an error with dll file from here http://www.oracle.com/technetwork/java/javase/downloads/jre8-downloads-2133155.html
Extract the folder out of the .tar file you downloaded.
Rename the JRE folder to "jre"
Then paste it in to this directory
C:\Users\"User Name"\AppData\Roaming\Appcelerator\Aptana Studio
This worked for me
I uninstalled all my Java JREs and JDK for Windows 10. Then I downloaded Aptana again and let it install Java for me. I think JAVA 8 was my problem, but this worked and I can still install the other versions again.
Related
I am new to Java. I am taking a University beginners Java course. I'm running my first hello world code and am getting an error message. I have installed the latest Dr. Java stable version and have installed Java SE 12 JDK.
I have uninstalled and reinstalled Dr. Java several times and still getting error message. I have also recompiled it to and still the error message is there.
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
I expected the code output to say, "Hello World" under the interactions pane but it isn't and instead there is an error message that says, "Current document is out of sync with the Interactions Pane and should be recompiled!".
Also, under the console pane I receive the following message:
Compiler is using classPath = '[C:\Users\Admin,
C:\Users\Admin\Downloads\drjava-beta-20190813-220051.jar]';
bootClassPath = 'null' Fatal Error: Unable to find package java.lang
in classpath or bootclasspath
Realizing that the OP solved his problem by version of JDK, I ran across this question after experiencing the same symptoms he describes. With that, it seems possibly appropriate to post a solution for the symptoms even though the problem ended up not being quite "identical" to the OP's situation:
I had the same problem with compilation not working. In my case, I am using a Linux system that has both OpenJDK and a manually installed Oracle JDK (extracted from a tarball obtained from java.com), along with some other JRE environments in various places. I "installed" the DrJava Version : drjava-20190813-220051 jar file and ran it from the command-line. I then clicked [ Manual Download ] when it asked about installing updates (drjava-beta-2019-220051).
DrJava reported that my compiler was JDK 8.0_222. Note, I don't know where that compiler came from. As far as I know, I didn't have that version installed. My OpenJDK was:
$ /bin/java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
I typed in a simple "Hello World" program, and every attempt to compile produced:
Compiler Output:
"Compilation completed."
This is a bug, because in fact compilation apparently did not complete.
Clicking Run produced:
Interactions
Welcome to DrJava. Working directory is /home/krb/Projects/Software/java
Current document is out of sync with the Interactions Pane and should be recompiled!
>
Restarting DrJava, saving, clicking Reset, etc., would not clear the problem.
In any event, at some point I noticed the Console tab was full of messages like:
Console
Compiler is using classPath = '[/home/krb/Projects/Software/java, /home/apps/drjava/drjava-beta-20190813-220051.jar]'; bootClassPath = 'null'
Fatal Error: Unable to find package java.lang in classpath or bootclasspath
At this point, I tried various things, but I focused on pointing DrJava to an Oracle Java JDK I had installed a few days ago. Everything I did was in Edit | Preferences ... | Resource Locations, though I beat around in there a while. All of the settings were "blank" before I started. Anyway, I eventually had some success after I'd set:
Web Browser
/usr/lib64/firefox/firefox
Web Browser Command
Tools.jar Location
/home/raid/apps/oracle/jdk-1.8.0_251/jre/lib/tools.jar
Display All Compiler Version [ ]
Extra Classpath
/home/raid/apps/oracle/jdk1.8.0_251/jre/lib
/home/raid/apps/oracle/jdk1.8.0_251/lib
NOTE: Your PATHs will NOT be the same as mine! You need to use the
actual paths on your system. In my case I searched for "rt.jar" and
"tools.jar" that were obviously in folders related to an installed
JDK.
At this point I decided to try to figure out the minimum required to get it working. After a lot of fiddling around, I found it is sufficient just to set Preferences | Resource Locations | Tools.jar Location, but with with one MAJOR caveat. You must BROWSE to the file using that dialog. YOU CANNOT JUST PASTE IN THE PATH! If you just paste in the path, it can look like it is set correctly, but the compiler will continue to not work. This was how I got the oracle jdk compiler to work.
Next, I set about to see if I could get OpenJDK to work. I searched my entire system for another tools.jar that belonged to OpenJDK, and did not find one. Then I realized I did not have the DEVEL OpenJDK package installed (on Mageia Linux 7).
java-1.8.0-openjdk-headless-1.8.0.252-1.b09.1.mga7
java-1.8.0-openjdk-1.8.0.252-1.b09.1.mga7
I installed:
java-1.8.0-openjdk-devel-1.8.0.252-1.b09.1.mga7
Now, even after resetting defaults, DrJava no longer says it is using JDK 8.0_222, but rather JDK 8.0-openjdk-1.8.0.252-1.b09.1.mga7.x86_64-OpenJDK, and everything works fine with NO customization to preferences!
I don't know where the heck JDK 8.0_222 came from. There's nothing on my system with that version. I rather suppose it is some internal thing in DrJava. I think the takeaways are:
If DrJava says its using JDK 8.0_222, it probably is not going to work!
Make sure you actually have a tools.jar installed if your system might split up the OpenJDK installation.
Point Tools.jar Location to an existing tools.jar file where the JDK you are using is installed, and making sure to browse to it (not just paste in a path).
I know what I saw was with Linux and a .jar install of DrJava, and this might not be what you have, but perhaps the information will be helpful in offering you things to look at and try.
As the answers above state, DrJava is not compatible with newer versions of Java than Java 8. Most of the DrJava codebase was written long before the open source version of Java was viable. The Sun Microsystems and Oracle javac compilers are proprietary and cannot be distributed with open source apps like DrJava. So DrJava searches for tools.jar (the library file containing the compiler in Java JDK distributions prior to Java 9) in common locations on Windows, Mac OS X, and Linux to find a compiler (more accurately, what were common locations in 2007). If you are running DrJava from a Java 8 JDK, it almost always finds it (although it appears to be failing for some installations Amazon Corretto 8). The most recent available build (March 3, 2020) of DrJava at www.cs.rice.edu/~javaplt/drjavarice may do a better job. I know it includes a later version the open source Java 8 compiler (JDK 8.0_242) and that it also finds the compiler (JDK 8.0_265) in the Corretto 8 distribution that I am using on Windows 10. The mysterious version of the open source JDK compiler reported above is being retrieved from the drjava.jar file itself. Now that the open source JDK includes a reliable compiler (which I suspect is nearly identical to the Oracle Java 8 SE compiler), the drjava.jar file includes a recent build of the open source Java 8 compiler.
Your solution helped me troubleshoot a problem with DrJava not recognizing the Amazon Carretta JDK on a Mac.
The fix is to open DrJava and go to Edit -> Preferences -> Resource Locations. From the Tools.jar Location box you must use the three dots at the end of that box to navigate to the tools.jar file on your Mac, which is probably in /Library/Java/JavaVirtualMachines/amazon-corretto-8.jdk/Contents/Home/lib/tools.jar.
I've been attempting to install NativeScript with Angular with this tutorial for the past two days, and I keep running into problems surrounding the Android SDK not installing correctly and freezing, and finally re-installing the latest JDK and JVE before attempting to install Android Studio. As I researched the problem I think I found the culprit:
When I run Javac -version I keep getting an older version of JDK, it states: javac 1.6.0_45 However I have the latest version of Jdk 1.8.0_102.
I researched the problem, but only found either complex solutions invilving the variable path, or MAC solutions. What can I do to update the JDK when I run Javac -version?
User Variables: PATH
cmd> set PATH=%PATH%;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;%NVM_HOME%;%NVM_SYMLINK%
System Variables: PATH
JAVA_HOME%/bin;C:\Python27\;C:\Python27\Scripts;C:\Ruby22-x64\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.6.0_45\bin;C:\Program Files (x86)\Beyond Compare 3;C:\Program Files (x86)\Brackets\command;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_102\bin;C:\Users\Godsnake\AppData\Local\Android\android-sdk\tools;C:\Users\Godsnake\AppData\Local\Android\android-sdk\platform-tools;%NVM_HOME%;%NVM_SYMLINK%;C:\Program Files\nodejs
Note:, I'm a complete noob at playing around with the Windows path, and I don't really know anything about the environment variable, but I see that the paths of certain applications that I have installed all appear in the system variables: Python, Node, Ruby, AngularJS2, AndroidSDK.. That being said if anyone can me some guidance on the uses, best practice, and differences between user variable and system variable that will be an added bonus. And please give me instructions like I'm a complete beginner when it comes to messing around with the path. Thanks!
Your system path still contains 1.6.
C:\Program Files\Java\jdk1.6.0_45\bin;
It has both, try removing this and just having 1.8. (already in there)
I removed the PATH entry which pointed to java JRE in Oracle client directory, leaving just 1 in PATH pointing to correct java JDK/JRE , and Kaboom it worked.
Use where java in cmd. You will find different versions of java. Leave the one you want to use and uninstall others.
I know there are lots of posts similar to this, but all of their answers require creating an .exe file. I want to know how to run a program in a folder without installing java.
I don't want to install Java 8 as it breaks some of my programs. I want to run a java program in a folder using a start.bat file that points to the java.exe file in the same directory. Like this:
"java.exe" -jar program.jar
The error is like this:
Error: Registry key 'Software\JavaSoft\Java Runtime Environment'\CurrentVersion'
has value '1.7', but '1.8' is required.
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.
Since the command window is opened in the same directory, "java.exe" should point to the java runtime.
Can I maybe copy java.dll to the directory to make it work? How can I do this without installing java 8? Could I use java ME?
Why don't you create a .bat file that declares a new JAVA_HOME and appends to the PATH just for this DOS/batch session, then you can point to a place where you have the required JRE (however, you kind of have to install it... it's a Windows thing).
I understand you are reluctant to install the JDK/JRE 8 on your Windows because of this: "I don't want to install Java 8 as it breaks some of my programs". But trust me, you can always change the JRE version on the Java Control Panel (windows >> control panel >> Java) and change the JAVA_HOME & PATH environment variables, you might have problems with your browser's plugins though, the Java install will affect them as well.. I guess, in that, case you can either try to skip this part of the install process or.. install JDK 7 again afterwards?
IF you just want to run this program, you can also install VirtualBox and create a VM with windows and install the JDK8 there, avoiding any problems in your OS.
I am trying to setup Android Studio on my Mac. It is running OSX 10.9.1 Mavericks. I have installed the latest JDK (at the time of writing 1.7 update 45), and I installed Android Studio. I use Java 7 because I have some Java applications I have to run and they require 1.7. I have not installed Java 1.6, because it is ancient and old. Launching Android Studio from any launcher does literally nothing. Activity Manager never shows it running. I do not want to install Java 1.6.
I did some work and tried to run the executable via command line through the package contents, and for both executables, I get these messages:
I am unsure what I am supposed to do to fix this error. I'm not very adept on a Mac (still somewhat new to it, and its confusing to do power user stuff on this) so if anyone can help me figure it out that'd be great. I'm on the 2013 Macbook Air with plenty of resources for this to run.
Update: This also applies to Yosemite, El Capitan, and all the other versions of OSX that can run Android Studio.
Update 12/11/2014
As of Android Studio 1.0 RC3 you can follow this set of directions to make it work.
I figured it out. You have to edit the android studio's Info.plist file in the package so it uses 1.7. I don't get why Android Studio insists we install and use an outdated, vulnerable version of Java.
Full resolution: http://i.stack.imgur.com/yyYaG.png
To open the package you need to find the Android Studio.app file in the Applications folder and right click it > Show Package Contents.
Edit the plist (I think you might need to be root) and change JVMVersion from 1.6* to 1.7* (or 1.8*, or whatever JDK major version you have). I don't get why that made a difference since my original output said it was using 1.7 anyways.
This fix seems to apply to all of IntelliJ's IDEs (I've seen it on PyCharm as well), though other ones seem to support newer versions of java natively.
As answered by hasternet # Android Studio was unable to find a valid Jvm (Related to MAC OS)
For quick and dirty solution, Follow the answer by Mgamerz; open Android Studio in Finder (CTRL+Click > Show Package Contests > Contents > info.plist) and edit Key JVMOptions>JVMVersion from "1.6*" to "1.6+"
Recommended method as discovered by Antonio Jose is to edit environment variables in MacOS (messing with info.plist is not recommended)
either at program launch (opening the Studio through terminal rather than the icon)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
or setting up the environment through AppleScript at every MacOS startup:
do shell script "launchctl setenv STUDIO_JDK /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk"
do shell script "launchctl setenv STUDIO_PROPERTIES /Users/username/Library/Preferences/AndroidStudio/idea.properties"
do shell script "launchctl setenv STUDIO_VM_OPTIONS /Users/username/Library/Preferences/AndroidStudio/studio.vmoptions"
(Remember to save the script as Application. Antonio Jose managed with just the first line - AFAIK you can use .properties and .vmoptions to set up additional settings.)
Official instructions: http://tools.android.com/tech-docs/configuration/osx-jdk
(The reason why Android Studio want's to run off of JRE 1.6 is because it apparently makes the fonts look better - feel free to go through that "official" route and install JRE 1.6 # http://support.apple.com/kb/DL1572 - you can then set the JDK to 1.8 in the SDK Location settings - local.properties)
mgamerz is right - The release notes give a much better solution for rc3 and onwards - theres a idea.properties file
(or environment variable)
~/Library/Preferences/AndroidStudio/idea.properties
it also shows what environment variables you can use to set things like the jdk
export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.7.0_67.jdk
ref : http://tools.android.com/recent/androidstudio1rc3_releasecandidate3released
I did below command on Mac Terminal to fix this problem, please make sure java version and path.
$java -version
java version "1.8.0_25"
Java(TM) SE Runtime Environment (build 1.8.0_25-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
$ export STUDIO_JDK=/Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk
$ open /Applications/Android\ Studio.app
Hey Friends I just Figured it out a simple way to fix this for Mac users.
Open Terminal and type this -> java -version and hit enter.
Output will be something like this:
Now check your Java Version. My Java version is 1.8
So now we need to Open Contents of our Android App.
For that right click the Android.app and then select Show Contents
Like this
Now there will be Content folder, Open that Folder and there you will find Info.plist
Open this info.plist
And you will see this.
In this expand the JVM
Here you will see the JVM version showing 1.6* but our jvm version is 1.8 (for example my jvm version is 1.8)
So we need to change this number according to our jvm version, so i changed it to version 1.8*
Then click save. And you are done.
Now you will see setup wizard running
And you are ready to start your first android programming app.
Here is the Whole Docx file for Android Studio Setup in Mac X
LINK: https://www.dropbox.com/s/9jwjebn5hgydyll/Android%20Studio%20Setup%20on%20Mac.docx?dl=0
I found that downloading an extra Java bundle from Apple fixed the issue.
If you search for this problem then I found the second link was to a blog having exactly this problem, all credit goes to him here
I know that posting links isn't an answer but as you can see from the resolution you need to make sure you have an up to date version of Java and also the Java bundle from Apple, for this reason I have also included the searches needed to get to these websites.
Here is where to download the latest version of Java
If this link is broken then searching "java latest version" return it at the top of the Google list
Here is where to download the Apple Bundle
If this link is broken then searching "Java for OS X 2014-001" returns it at the top of the Google list
For me trying to solve this problem it appears that initially it was an issue that required a work around and then Apple released an official work around download meaning that fiddling in plists is not necessary any more.
I am having a problem with running java from cmd.exe.
When i type in 'java' this errors shows:
Error: could not open `D:\Program Files (x86)\Java\jre6\lib\i386\jvm.cfg'
The problem is, my java is not in jre6, but in jre7. The jre6 folder doesn't even exist anymore.
I've checked the path and all other environmental variables and java was not mentioned anywhere. So I updated path to point to D:\Program Files (x86)\Java\jre7\bin but that didn't help.
I am running Windows 7 64-bit so I also tried running java from 64-bit cmd.exe but it didn't help.
Is there anywhere else except path to look and change the way Windows looks for java?
The problem is that older JDKs copy java.exe among some other Java executables into C:\Windows\System32 which happens to be on the PATH before the new JDK/JRE location.
The solution is to delete java.exe and other Java related executables from System32 as they aren't required any more. This could however potentially break applications that depend on the older JDK/JRE and hence they may need to be re-configured.