hello everyone!!!
i was just wondering on how to create an online compiler for java (Java Online Compiler) like where do you start, what language should i use?
i'm planning to make this as my senior project.
any suggestions would be appreciated..
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
hello everyone!!!
i was just wondering on how to create an online compiler for java (Java Online Compiler) like where do you start, what language should i use?
i'm planning to make this as my senior project.
any suggestions would be appreciated..
I guess it would be possible to do this server-side. Accept a text field full of code and attempt to compile it with javac; returning either the compiled .class file or the stack trace. Such an application would be useless to everyone and open to all kinds of malicious use which would DoS your server at best.
If you are thinking about writing your own ACTUAL compiler for java which would run online; forget about it. The language specifications are proprietary and too complex for any lone developer to tackle.
FYI, it is not proprietary, but complex? Yes
Java SE Specifications
...and the javac compiler is open source
The Compiler Group
@sb24, perhaps you should think about why you wish to develop this project. Would this benefit a community at large? Would it get used? Is this a unique tool? I ask these questions because I personally don't see the goal outweighing the effort (but I encourage you to convince me otherwise). And to answer your question, you can use whichever language you wish, provided that language facilitates web application development.
It would only be useful for simple compiles that don't require non Java SE classes.
I don't see how it would be open to malicious use.
thanks for the comments i'll put everything in mind
Oh, in that case I am just confused about the reasons for Oracles law suite against Google. I thought it was because they felt Google violated their intellectual property by rewriting java to their needs. Sorry for the mistake.
It would be a simple matter to automate mass requests for compilation in such a system. This would cause a denial of service which is a breach of availability; malicious use.Originally Posted by Norm
Hi, I would not debate about the usefulness of an online compiler which you are going to build. I just want to suggest a solution technically. You can use the System.getRuntime().exec() method to execute the javac process, then capture the output by calling Process.getOutputStream(). Look at the Java API for more details.
Also look at the javax.tools package. There is a class: JavaCompiler that could be useful.
If you don't understand my answer, don't ignore it, ask a question.
Can you post the links you found?
If you don't understand my answer, don't ignore it, ask a question.
Online compilers already exist. See: ideone.com (btw, this covers many languages including java).
so this is the idea that i have in mind...
With Java Online Compiler, users can write, compile their code. The compiler will then return the class files to the user which the user then can run to verify the output of the program.
the idea is simple and i would like to know your comments
Sounds like it could be useful to some students.
If you don't understand my answer, don't ignore it, ask a question.
Personally, I find writing a decent Java compiler over two semesters is a really long stretch. Today's compilers were a result of years of work from very large teams of talented dedicated compiler writers. However, if you have the JDK installed on the server and just pass the source to javac (similar to what other current online compilers do), you could probably finish the whole thing in a week or two, depending on how much time and effor you spend. There isn't really much middle ground.