Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Tried to Run Code in Java, but Ran in Python #10

Closed
@loop0919

Description

@loop0919

Describe the bug
A clear and concise description of what the bug is.

To Reproduce

  • Execute this Python code
import judge0

JUDGE_API_URL = "http://my.own.server:2358"
CLIENT = judge0.Client(endpoint=JUDGE_API_URL, auth_headers={"Content-Type": "application/json"})


if __name__ == "__main__":
    code = '''\
public class Main {
    public static void main(String[] args) {
        System.out.println("Hello World");
    }
}
'''
    submission = judge0.Submission(
        source_code=code,
        language=judge0.LanguageAlias.JAVA,
    )
    print(submission.language)
    result = judge0.run(client=CLIENT, submissions=submission)
    print(result.language)
    print(result.status)
    print(result.stderr)
  • Output it
LanguageAlias.JAVA
LanguageAlias.PYTHON
Runtime Error Nzec
  File "script.py", line 1
    public class Main {
           ^
SyntaxError: invalid syntax

Expected behavior
It would be executed by Java.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Amazon Linux 2023
  • Browser chrome
  • Version Python3.10.12, Judge0 v1.13.1

Additional context
Using server crerated by https://github.com/judge0/judge0 v1.13.1

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions