piston
piston copied to clipboard
Change Java to compiled language to facilitate multi-file
Pull Request: Enhance Java Support for Multi-File Submissions
Overview
This pull request aims to extend the functionality of our Java execution environment to support multi-file Java programs. Historically, our system has only supported single-file submissions, limiting the complexity and scope of projects that users can run. This update is a significant step towards accommodating more advanced Java applications and improving the versatility of our execution platform.
Goals
- Primary Objective: Introduce multi-file support for Java submissions without impacting the existing support for single-file Java programs.
-
Maintain Compatibility: Ensure that single-file submissions continue to function as they have, even when the submitted
.java
file's name does not match the public class name.
Changes
1. Multi-File Support Implementation
-
New Compile File: Added a
compile
file to the Java package. This script leverages the existing Piston infrastructure to compile and execute multi-file Java programs. It automatically detects and compiles all.java
files present in the request
2. Single File Submissions
-
No Changes for Single File: The process for single file submissions remains unchanged. Users can submit a
.java
file where the file name does not necessarily match the public class name, and it will continue to be supported seamlessly.
3. Multi-File Java Program Support
-
Main File Requirement: For multi-file submissions to be executed correctly, the "main" file containing the
public static void main(String[] args)
method must be the first file passed into the API. This ensures the correct entry point is identified and executed.
Hi!
I talked about this pull request awhile ago with Hex who asked me to push it upstream. I'm only about a year late in actually getting to this, so it may not be something that is wanted/needed anymore.
Hi!
I talked about this pull request awhile ago with Hex who asked me to push it upstream. I'm only about a year late in actually getting to this, so it may not be something that is wanted/needed anymore.
I think this feature is required. I am having a similar request in these lines, where i can be able to have a multi class single java file to execute. Currently it is not supported with piston.
Just a note!
I identified a minor bug with file passing, aka if you want to pass in a .txt file that a .java file should read from. I have resolved this issue and will commit changes soon.
Any updates?