Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] Code Runner only runs Java class with the specific file name "InterLeaveArrays"; other capitalizations or letter combinations fail #1183

Open
Muyu-Chen opened this issue Oct 20, 2024 · 0 comments

Comments

@Muyu-Chen
Copy link

Muyu-Chen commented Oct 20, 2024

  • VS Code Version: 1.94.2 (system setup)
  • OS Version: Windows_NT x64 10.0.22631
  • Code Runner Version: v0.12.2

Describe the bug
I encountered a strange issue with Code Runner in VSCode when running a Java file named InterLeaveArrays.java. The program only runs correctly when the file name and class name are exactly InterLeaveArrays.java (with uppercase I, L, and A). Any other capitalization or letter combinations (e.g., InterleaveArrays, interLeaveArrays, InterLeavearrays, or InterLeaveARrays) fail to run.
The Code Runner always uses the command "cd "D:\my\file\path" && javac InterLeaveArrays.java && java InterLeaveArrays" for every file name I mentioned. This command generated by Code Runner is quite confusing. I have checked my Code Runner executor map, and there are no issues with it. Additionally, for other valid file names like "LeaveArrays.java" or "InterArrays.java", everything works perfectly.

To Reproduce
Steps to reproduce the behavior:

  1. Create a Java file named interleavearrays.java with the following content
public class interleavearrays {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
  1. Run the file using Code Runner.
  2. Change the capitalization of the class name and file name (e.g., InterleaveArrays, interLeaveArrays, InterLeaveARrays) and try running it again.

Actual behavior
The command generated by Code Runner is:
cd "d:\file\path" && javac InterLeaveArrays.java && java InterLeaveArrays

Expected behavior
The command generated should be like this: cd "d:\file\path" && javac interleavearrays.java && java interleavearrays
The Java file should run successfully regardless of capitalization, as long as the class name matches the file name.

Screenshots
I apologize if my language was unclear. Here is the explanation:
"错误: 找不到或无法加载主类" means “Error: Could not find or load main class”
“原因” means “Cause”
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant