While I have some experience in Python and JavaScript, I am new to Java and am trying it out for the first time. To get started, I went to http://www.java.com, downloaded the dmg there, and then used the package it gave me to install Java. After doing so, I received confirmation that Java had been installed successfully and I closed and trashed the dmg and package. Afterwards, I hopped on my terminal (I am using a Mac running on MacOS Monterey) and tried to use javac on a script I wrote. I received the following error message:
The operation couldn’t be completed. Unable to locate a Java Runtime that supports javac.
Please visit http://www.java.com for information on installing Java.
I went online and did some typical troubleshooting searches. First, I found a site suggesting that I create an environment variable $JAVA_HOME and set it equal to $(/usr/libexec/java_home) in .zshenv (yes, I use zsh not bash). I followed this instruction and when I run echo $JAVA_HOME I get /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home. However, running javac still did not work.
Once more, I went online and this time, I found the suggestion of adding javac to $PATH. So I went into .zshenv and added usr/bin/javac to $PATH (the $PATH export line now looks like this: export PATH="/Users/[redacted]/Library/Python/3.8/bin:/usr/bin/javac:$PATH"). This alteration was confirmed when I exited an reentered terminal and ran echo $PATH. However, once again, running javac yielded the same error.
I feel as if I am facing what must be a pretty common and easily fixable issue, but yet, I haven't yet been able to find a solution that works despite perusal of several other StackOverflow posts and tech articles. Still, I know I'm probably missing something simple, and if this is a duplicate of another question, please link that question in a comment, and I'll take this one down.
Thanks!
Related
I am trying to launch WildFly via IntelliJ
When I add the following line inside the Startup Script:
..\bin\standalone.sh -c standalone-full.xml
I get an error saying:
Error running 'JBOSS':
Cannot run program "C:...." (in directory "C...": CreateProcess error=193, %1 is not a valid Win32-program
I've read on StackOverFlow that this might be a mismatch between 32 bit and 64 bit DLL files? But I doubt this is the case. It works fine without that tag, but I need to launch my server with this startup script.
Or am I missing something else when trying to run a .jar file? I have javac, JAVA_HOME and java -version setup, am I missing something else?
I'm answering my own post because my situation was a really special one, but none the less it would have helped me if I began at this point.
My first issue was that I had no idea I was supposed to use the bat script. (I bet this will give some laughs but whatever)
The second issue, which made everything so confusing, was that my JBOSS_HOME environment variable wasn't setup right.. Well what do you mean wasn't setup right, that's easy bro? Well yes of course it is - but IntelliJ didn't register it properly. So whenever I configured everything, it kept saying that it looked toward another directory, and might not work properly within JBOSS's console.
My fix:
Path was setup correct, but under IntelliJ IDEA's values, it said %JBOSS_HOME%\bin. I wasn't sure if it pointed to the same JBOSS setup that Windows does, or if it pointed to one I had deleted. I removed this from IntelliJ IDEA's path (NOT the Path within Windows) and now IntelliJ finds my JBOSS correctly and it works..
Maybe this helps someone in the future. It would have saved me some time, but atleast I learnt something.
I desperately need some help in installing Java on my server on GoDaddy. At first, I followed instructions mentioned here: https://www.tecmint.com/install-apache-tomcat-in-centos because installing Tomcat is my actual goal. I downloaded 'jdk-8u101-linux-x64.rpm' and did everything as mentioned in the tutorial. At the end of it, when I try to test using the command java -version, I get -bash: java: command not found. It didn't work even after logging out and logging in again.
Then I followed instructions as mentioned here: https://in.godaddy.com/help/how-to-install-java-on-ubuntu-12351 and got the same error at the end.
When I try whereis java, I get /usr/bin/java /usr/local/java /usr/share/java. Is it that there are many Java instances and that's why the command isn't executing?
NOTE: The $PATH(/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/opt/cpanel/composer/bin:/usr/local/java/jre1.8.0_25/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin) does include the bin folder of jre.
Any help would be greatly appreciated. Thanks in advance :)
Turns out my Java was installed at a different location completely and that wasn't included in the path. This tutorial(https://www.tecmint.com/install-apache-tomcat-in-centos) explains everything in detail except it missed out the point to add Java to the path.
Added that to the path and it's working perfectly since then. Thanks for your help guys :)
I suggest you debug your problem by step by step (Do not follow any step without having success in all the steps before):
Determine which directory java has been installed to. According with the URL you said, it must be /usr/local/java/jre1.8.0_25. Right?
Set the current directory to that path and look for a file named "java", on which you shall have execution permission. If it is not there, java has not been successfully installed. Try re-installing again.
Execute "java -version" from the command line. It should show "1.8.0". If not, the installation is wrong and you should try re-installing too.
Switch to your HOME path, and try to execute "/bin/java". The result should be the same as in point 3.
Ensure that path is correctly included into the PATH environment variable. Try then "java -version". The result should be the same as in point 3. If not, check the PATH variable.
so I've checked many posts here and tried everything people suggested and I'm still getting "Could not find or load main class" error, and my professor wasn't very helpful in his answer when I asked for help.
This is what my professor said is supposed to work (he is using OSX).
java -cp classes:lib/json.jar cst420.jsonrpc.client.GroupServerJavaStub http://127.0.0.1:8080
After reading some other posts on this site, I also tried:
java -cp classes:"lib/json.jar" cst420.jsonrpc.client.GroupServerJavaStub http://127.0.0.1:8080
java -cp "lib/json.jar" cst420.jsonrpc.client.GroupServerJavaStub http://127.0.0.1:8080
Still nothing works. I'm in the base directory in a bash prompt ~\GroupJsonRPC and the class file that is in ~\GroupJsonRPC\classes\cst420\jsonrpc\client\GroupServerJavaStub.class exists and is ready for running. The same goes for ~\GroupJsonRPC\lib\json.jar. Any insight into how to get this darn thing running would be greatly appreciated!
PS: I'm using Windows.
The proper command is:
java -cp "classes;lib/json.jar" cst420.jsonrpc.client.GroupServerJavaStub http://127.0.0.1:8080
You need to be sure to include the directory of your class files as well as the jar file(s) with ';' separators, and don't use the -jar option. It invalidates the -cp option.
I have problems after uninstalling jdk 7 on mac book pro with rm -rf /Library/Java/JavaVirtualMachines/jdkmajor.minor.macro[_update].jdk
I also have installed java 8 and Intellij works well. But any attempt to run java -version or mvn crashes with error:
dyld: could not load inserted library '/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib' because image not found
[1] 1216 trace trap mvn
And in the same time I can build all the projects with IntelliJ.
I even can't run vim - I have the same mistake.
So, my questions:
1. What is the correct way to uninstall JDK?
2. What should I do in my situation to restore the system?
As mentioned by mattias in his answer, your problem stems from a command in one of your bash startup files, that tells bash to load certain dynamic libraries before it attempts to run any command.
Using unset DYLD_INSERT_LIBRARIES will only solve this temporarily, for the current running terminal. So you should fix the problem permanently, by first running that command, and then editing your .bash_profile and .bashrc files with vim or nano.
If you see a line that says
export DYLD_INSERT_LIBRARIES=/Library/Java/JavaVirtualMachines/jdk1.7.0_55.jdk/Contents/Home/jre/lib/libjsig.dylib
just remove this line. If it inserts any additional libraries in addition to that libraries, just erase this particular library from /Library to libsig.dylib including the following : (if it's the last one, then the preceding :).
Exit Terminal, run it again and make sure your problem has been solved.
The procedure you have been following for removing the JDK is the correct one as suggested by Oracle. The problem was that once in the history of that machine, you or whoever was using it added that library to the DYLD_INSERT_LIBRARIES environment variable and this caused the problem. Also, the reason why this did not affect IntelliJ is that it is not running through bash, so bash commands do not affect it.
If you want to remove any other Java version, you should do the same as you did before, but make sure in advance that nothing in DYLD_INSERT_LIBRARIES refers to something inside /Library/Java/JavaVirtualMachines.
Have a look in your .bash_profile and try to look for
export DYLD_INSERT_LIBRARIES=/usr/lib/libSaturnFE.dylib
export DYLD_FORCE_FLAT_NAMESPACE=1
or anything similar. These might be causing the problem you experience.
Try commenting them out and reload your bash with
exec bash
and see if the problem persist.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I need help with this. It started with me trying to update Java & when I tried
this is the message I got:
"ERROR 1723: There is a problem with this Windows Installer Package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor."
I've already tried deleting Java 6 update 14, but it won't allow me to, oddly enough I get the same message. What can I do?
I had the 1723 problem (Windows 7) when attempting to uninstall JRE 6.30. I don't think the version matters for this error. I believe it is caused by having multiple version of Java installed at the same time. When uninstalling one of them it removes some file needed to uninstall the other versions and you are left in a state where you can't reinstall or uninstall the JRE. I used the Microsoft FixIt tool [stand alone download here]. I created the portable fixit and then ran on my local machine. The tool has a list of fixes and you need to find "Fix problems with programs that can't be installed or uninstalled" and click "Run Now". The wizard is self-explanatory and after running will show something similar to this:
Once you see this, double check your control panel that the JRE was actually uninstalled (and attempt to install if desired).
Have a look at this post for additional information about solving this issue.
Update:
Here is the brief summary of the original Problems with Java installation discussion.
Sometimes, when you attempt to run the java installer file you receive the message:
This software has already been installed on your computer.
Would you like to reinstall it?
When you click Yes to the above question you receive the error:
This action is only valid for products that are currently installed.
This problem is caused because the Windows Installer information for a previous installation of Java has been removed or damaged, but the related registry keys are still present causing the Java installer to think it is already installed.
To fix this issue you should do the following:
If you are able, uninstall all previous versions of Java in add/remove programs in your control panel.
Next, you may download the current version of Java
It's recommended that you use the offline installer version.
Run the following commands in cmd:
_
reg query hklm\software\classes\installer\products /f "java(tm) 6" /s | find "HKEY_LOCAL_MACHINE" > deljava.txt
for /f "tokens=* delims= " %%a in (deljava.txt) do reg delete %%a /f
del deljava.txt
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /f
reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\wow6432node\JavaSoft\Java Runtime Environment" /f
I had a similar problem on my Windows 7 box where I was trying to uninstall Java and do a clean install of a newer version. Something got messed up and I would get the 1723 error message during the uninstall and attempted reinstall. Here's information about how I was able to fix the problem, and maybe this will help you:
Look at the log files for the uninstall/reinstall. On Windows 7 they can be found at c:\users\username\AppData\Local\Temp\
The java_install.logdidn't show any extra information, but I had several MSI##### log files that contained error messages about the failed uninstall. The message was: Error 1723.There is a problem with this Windows Installer package. A DLL required for this install to complete could not be run. Contact your support personnel or package vendor. Action UninstallJRE, entry: MSIUninstallJRE, library: C:\Program Files\Java\jre6\bin\regutils.dll
There was indeed no regutils.dll file, and not even the bindirectory was there. So I copied over a regutils.dll file from another computer, ran the uninstaller, and it worked. Then the new clean install of Java also worked.
So take a look at your logfiles and hopefully that will give you more detailed information about the 1723 error.
I guess this should be asked in superuser.com but I don't have enough reputation to move it.
Anyway, the installation package comes as a msi file, correct? If so you can try to run msiexec with log enabled.
Best
One way (only way which worked for me - i tried most of the things listed in this post, including MockerTims script) was to search through Windows Registry for Java and then carefully remove anything that seemed to point to the specific JRE version i wanted to remove.
Steps are roughly as such:
Hit Windows button and type into the search field "regedit". Pick the result of the search, which is regedit.exe.
Select the top of the tree and hit CTRL + F.
Type in Java to 'Find what' field and hit enter.
Manually go through every found object (hit F3 to proceed to the next item).
If the item is referring to the JRE version you want to remove, then delete the entry. Otherwise leave it be and continue on to the next item.
I have tried all of the tricks stated above and nothing was able to resolve my problem. Changing the path way, registry being corrupted, few dlls weren't able to be deleted and so on and on... I used Fixit and deleted whatever I saw with the name JAVA. I tried installing GRE/JVM separately, nothing worked what so ever.
Solution..
http://www.java.com/en/download/help/windows_offline_download.xml
Use offline install of JAVA or some people call it silently install JAVA. This fixed my problem that I couldn't fix in two days.
After this I was able to install eclipse without getting any pathway error message, or dll related messages.