Installing CPLEX on Mac: No Java virtual machine could be found - java

I try to install CPLEX on my Mac. When I open terminal and type
chmod +x /Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin
I get the following error
Preparing to install...
Extracting the installation resources from the installer archive...
Configuring the installer for this system's environment...
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin: line 2374: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java: No such file or directory
/Users/MarjoleinKroon/Downloads/cplex_studio126.osx.bin: line 2374: Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java: No such file or directory
No Java virtual machine could be found from your PATH
environment variable. You must install a VM prior to
running this program.
I searched the internet to solve this problem, and I found several things to check. If I type java -version I get
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
So it seems like java is installed properly. Furthermore, when I type /usr/libexec/java_home -V, a VM seems to be there:
Matching Java Virtual Machines (1):
1.8.0_40, x86_64: "Java SE 8" /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
/Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home
Online I read something about PATHs, but I have not enough knowledge to understand this exactly. However, if I type echo $PATH I get
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/texbin
I don't know what this means, but it seems kind of strange to me.
Can anyone help me? Please be as clear as possible, because I don't have a lot of knowledge concerning this. Thanks in advance!

Related

jpackage command is not recognized

I am trying to package a jar file into an executable file using the jpackage tool in Java, but the command is not recognized in the command prompt using Windows 10 and Java version:
> java --version
java 17.0.1 2021-10-19 LTS
Java(TM) SE Runtime Environment (build 17.0.1+12-LTS-39)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)
I have the full JDK installed and the command javac is recognized.
I checked my computer with the "where java javac jpackage" command and it only found the first two in the CommonFiles folder.
I looked in the folder path "ProgramFiles\Java\jdk-17.0.1\jmods" and both the "jdk.jlink.jmod" and "jdk.jpackage.jmod" files are present.
Can someone please help me figure out why the tool isn't recognized by Windows?
I found the issue to be the way my Environment Variables were set up for Java. To fix my problem, I went into the JAVA_HOME variable and changed the entry from
C:\ProgramFiles\Java\jdk-17.0.1\lib
to
C:\ProgramFiles\Java\jdk-17.0.1
Next I updated the path variable to include "%JAVA_HOME%\bin". Before I had it listed as C:\ProgramFiles\Java\jdk-17.0.1\bin. Both of these changes were made under the System variables using the "Edit" button. I want to thank dave_thompson_085 for pointing me in the right direction.

Minecraft Client environment not running through vscode on MAC

For some reason this issue is to do with with gradle and yarn, no matter what I do to try and get the 'fabric-loom' plugin working, nothing works. It says i am using an outdated version of Java, that i'm on Java 11 (I'm not, I did 'java -version' in the bash terminal), I'm on Mac btw, and it said I'm on Java 16.0.2, which is the version it tells me to be on, I'll attach logs and some code I wrote. If someone could help me, that would be great, thanks in advance :)
Crash Log:
Could not run phased build action using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-7.2-bin.zip'. Build file '/Users/joeplemople/Desktop/joes blocks/build.gradle' line: 2 An exception occurred applying plugin request [id: 'fabric-loom', version: '0.9-SNAPSHOT'] Failed to apply plugin 'fabric-loom'. You are using an outdated version of Java (11). Java 16 or higher is required.
(This was outputted twice for some reason, idk why)
Terminal Code (Bash):
Displaying what versions of java I have installed JoepleMoples-MacBook-Pro:
joes blocks joeplemople$ /usr/libexec/java_home -V Matching Java Virtual Machines (2): 16.0.2, x86_64: "Java SE 16.0.2" /Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home 11.0.12, x86_64: "Java SE 11.0.12" /Library/Java/JavaVirtualMachines/jdk-11.0.12.jdk/Contents/Home
Me setting the default version of Java to Java (JDK) 16:
/Library/Java/JavaVirtualMachines/jdk-16.0.2.jdk/Contents/Home JoepleMoples-MacBook-Pro:joes blocks joeplemople$ export JAVA_HOME=$(/usr/libexec/java_home -v 16.0.2) JoepleMoples-MacBook-Pro:joes blocks joeplemople$ java -version java version "16.0.2" 2021-07-20 Java(TM) SE Runtime Environment (build 16.0.2+7-67) Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)
Thanks in advance
:)
Open Command Palette and choose Java: Configure Java Runtime, select jdk16 for both Project JDKs and Java Tooling Runtime.
Then reload window to make change effective and see if the error goes away.

Failed to find Java VM

I've always used Google2SRT, a light software to download subtitles from Youtube. Now it no longer works: "Startup Error: Failed to find Java VM".
I have Java installed, I have Netbeans installed and working, I have never had any Java related issues.
I've tried reinstalling everything, I've tried creating a JAVA_HOME and JRE_HOME System variable and pointing it to "C:\Program Files\Java\jre1.8.0_191" according to this tutorial: https://confluence.atlassian.com/doc/setting-the-java_home-variable-in-windows-8895.html
It felt odd because I didn't even had this environment variable previously. I have no idea what's the issue.
I've tried uninstalling Netbeans and other programming tools as well.
I'm on Windows 7 x64.
java -debug -version > "%userprofile%\desktop\javaDebug.log" 2>&1 returns:
java version "1.8.0_191"
Java(TM) SE Runtime Environment (build 1.8.0_191-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.191-b12, mixed mode)
I have also tried setting maximum heap size in _JAVA_OPTIONS
System Variables
Just go to the install dir (e.g. C:\Program Files (x86)\Google2SRT), open a cmd.exe, cd to the above folder and type java -jar Google2SRT.jar. You don't need the .exe
This should work, provided you have java installed. Check by typing java -version in the cmd.

Java Axis 2 Script wont start without JAVA_HOME Mac OS

Hello guys this is the first time i write a question here and not just read an answer.
My problem is that I have a Macbook with Sierra on it and hava a tomcat with my wsdl file and i wanted to generate my classes with axis2 so i started the wsdl2java.sh in Eclipse and till that point everything works fine.
But then it says:
You must set the JAVA_HOME variable before running Axis2 Script.
but when i open a terminal and lookup for
echo $JAVA_HOME it will say:
/Library/Java/JavaVirtualMachines/jdk1.8.0_101.jdk/Contents/Home
and also when i type in java -version i get this result:
java version "1.8.0_101" Java(TM) SE Runtime Environment (build
1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
my question is why does eclipse not found my JAVA_HOME path?
i allready started eclipse as sudo directly through the terminal and also tried to change the .bash_profile but nothing works for me
I hope i described the Problem so that you can help me !
thanks a lot
As Minh Kieu recommended in the comments, I added this to the shell script of wsdl2java:
export JAVA_HOME=$(/usr/libexec/java_home)
Then I restarted Eclipse and now it worked.

Problems with Java installation (making using Spark difficult)

I am trying to get Spark running locally. When I launch it, I get the following error, suggesting something is weird with my java installation (or the path to it). This is on Mac OS Yosemite.
line 190: /usr/java/jdk1.7.0_51/bin/java/bin/java/bin/java: No such file or directory
Any suggestions how to remedy this? Let me know if you need more info (I don't know where to start)
Edit: Clearly there is a setting wrong somewhere, I'm just not sure where.
In my bash-profile, there is a line
JAVA_HOME=usr/bin/java
Also when I run java -version I get:
java version "1.8.0_40"
Java(TM) SE Runtime Environment (build 1.8.0_40-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.40-b25, mixed mode)
Solution:
Something was weird with where Spark was looking for Java. Not sure how the default is set, but I found a way to override it.
1) In terminal run this and copy and paste the results. This gives you the path of your Java installation.
$(dirname $(readlink $(which javac)))/java_home
2) In the spark-whatever/conf folder, make a file "spark-env.sh" and write "export JAVA_HOME="

Categories

Resources