简体   繁体   English

Java无法在我的电脑上运行

[英]Java is not working in my PC

I had installed Java in my PC and it was working perfectly. 我在我的电脑上安装了Java,它运行得很好。 Suddenly something went wrong and now I m not able to open swing applications and its showing the error 'Java not found'. 突然出现问题,现在我无法打开swing应用程序并显示错误“Java not found”。 But I can run the Eclipse IDE which also needed Java to run. 但我可以运行Eclipse IDE,它也需要运行Java。 So I decide to reinstall the Java, but when I tried to uninstall the Java it shows the Error 1723 - There is a problem with this Windows Installer Package. 所以我决定重新安装Java,但是当我尝试卸载Java时,它显示错误1723 - 此Windows Installer程序包存在问题。 So I have installed a new JDK in another location and set the PATH. 所以我在另一个位置安装了一个新的JDK并设置了PATH。 Still I am not able to run the Swing application. 我仍然无法运行Swing应用程序。

Can anybody help me on this? 有人可以帮我这个吗?

How are you running your swing application? 你是如何运行你的挥杆应用程序的? If it's from the command line like java mySwingApp and you're getting java not found then your PATH isn't set properly. 如果它来自命令行,如java mySwingApp并且您java not found那么您的PATH设置不正确。 Make sure that the java/bin directory is on your PATH not just the top level directory. 确保java / bin目录位于PATH上,而不仅仅是顶级目录。 You can test your PATH by just typing java in a console window - it should print the java help page. 您只需在控制台窗口中键入java即可测试PATH - 它应该打印java帮助页面。

If you're not running from a terminal like above, then you may need to set a JAVA_HOME environment variable which points to your java installation folder. 如果您没有从上面的终端运行,那么您可能需要设置一个指向您的java安装文件夹的JAVA_HOME环境变量。 Here's a tutorial on setting JAVA_HOME Setting JAVA_HOME 这是一个关于设置JAVA_HOME 设置JAVA_HOME的教程

Hope this helps, 希望这可以帮助,

Will

This is close to jakob's answer, about trying to get your Java install setup correctly again, just with a little more detail. 这接近于jakob的答案,关于尝试再次正确地进行Java安装设置,只需更多细节。

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. 我在我的Windows 7机箱上遇到了类似的问题,我试图卸载Java并对新版本进行全新安装。 Something got messed up and I would get the 1723 error message during the uninstall and attempted reinstall. 有些东西搞砸了,我会在卸载期间收到1723错误消息,并尝试重新安装。 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\\ 在Windows 7上,可以在c:\\users\\username\\AppData\\Local\\Temp\\

The java_install.log didn't show any extra information, but I had several MSI##### log files that contained error messages about the failed uninstall. java_install.log没有显示任何额外信息,但我有几个MSI#####日志文件,其中包含有关卸载失败的错误消息。 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 消息是: 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 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 bin directory was there. 确实没有regutils.dll文件,甚至bin目录都没有。 So I copied over a regutils.dll file from another computer, ran the uninstaller, and it worked. 所以我从另一台计算机上复制了一个regutils.dll文件,运行了卸载程序,它运行起来了。 Then the new clean install of Java also worked. 然后新的Java安装也工作。

So take a look at your logfiles and hopefully that will give you more detailed information about the 1723 error. 因此,请查看您的日志文件,希望能够为您提供有关1723错误的更多详细信息。

This usally happens when you delete Java files manually. 当您手动删除Java文件时,通常会发生这种情况。 If you try to uninstall Java and it fails, it generates a log file. 如果您尝试卸载Java并且失败,则会生成一个日志文件。 Should be in C:\\Users[Username]\\AppData\\Local\\Temp Almost at the end the missing file(s) can be found. 应该在C:\\ Users [Username] \\ AppData \\ Local \\ Temp几乎在最后可以找到丢失的文件。 Try to copy that file(s) from a working installation to your computer. 尝试将该文件从正常工作的安装复制到您的计算机。 Then you should be able to uninstall your Java and install a new version. 然后,您应该能够卸载Java并安装新版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM