简体   繁体   中英

Java virtual machine launch issue

HI All,

I got an issue, all of a sudden Java stopped working completely. I start getting error like "Could not create the virtual machine". There is no issue with the memory (it has 3GB RAM) and was working fine for over a 6 months in this system without any issue.

Here are some peculiar behaviors -

  1. When I start eclipse I see Java virtual machine dialog box with error messages like
    "Could not find main class org.eclipse......support.legacysystemproperties"

  2. Eclipse is able to start(with above error), but while running the program, I get error like "Could not create Java Virtual Machine" in a dialog box and after I click OK on that dialog box, I see error like "unrecognized option -dfile.encoding=cp1252

  3. I used text editor, wrote a class Test.java (without any package), compiled it ( Edit #1: javac Test.java ). But when I execute the program ( Edit #1: java Test ), I get the following error - Exception in thread "main" java.lang.NoClassDefFoundError: test (wrong name: Test).

Edit #1: Note : The compiled file, Test.class is successfully created in the directory. I did recheck the path and classpath environment variables. All seem to be correct.

Please note that there seems to be some issues with cases which affected the Java.

I did uninstall Java (all versions), re-installed, but nothing helped. Also, I did run CCleaner to clean registry, Malwarebytes' Anti-Malware, but none helped so far.

Appreciate if someone could help me to resolve the issue.

I did googled for this and found that some have experienced similar issues, but none of them have found solution yet other than some suggestion that re-installation of Windows OS itself, which I want to avoid it. I did system restore, but that failed for some other reason.

Please note that am using Java for over 10 years. This is first time am having such issue. This is something to do with Windows Registry or some other system configuration, but I am not able to find out the exact problem.

Anyways awaiting some good suggestion.

EDIT: Okay, so it looks like the Java executable is getting the command line arguments lower-cased.

Step 1: Verify

You can double-check whether this affects all command line arguments by creating a class with a lower-case name which just dumps its arguments:

public class test {
    public static void main(String[] args) {
        for (String arg : args) {
            System.out.println(arg);
        }
    }
}

Compile and run this with a variety of inputs.

Step 2: Check scope

Assuming step 1 confirms the problem, if you've got .NET installed you can see whether it affects that as well. Create a file Test.cs:

using System;

class Test
{
    static void Main(string[] args)
    {
        foreach (string arg in args)
        {
            Console.WriteLine(arg);
        }
    }
}

Compile this with "csc Test.cs" having found csc in the .NET framework directory (eg in c:\\Windows\\Microsoft.NET\\Framework\\v4.0.30319 for .NET 4).

Run it like this:

Test foo BAR Baz

and see what happens

Step 3: If step 2 showed that the issue is limited to java.exe:

  • Check your path, and work out where you're actually running java.exe from
  • Try explicitly running java.exe from your JRE or JDK directory

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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