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.

Results 1 to 16 of 16

Thread: Java Online Compiler

  1. #1
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java Online Compiler

    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..


  2. #2
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: Java Online Compiler

    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.

  3. #3
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java Online Compiler

    Quote Originally Posted by ChristopherLowe View Post
    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.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Online Compiler

    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.

  5. #5
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Online Compiler

    thanks for the comments i'll put everything in mind

  6. #6
    Forum VIP
    Join Date
    Jun 2011
    Posts
    317
    My Mood
    Bored
    Thanks
    47
    Thanked 89 Times in 74 Posts
    Blog Entries
    4

    Default Re: Java Online Compiler

    Quote Originally Posted by copeg View Post
    FYI, it is not proprietary ...
    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.

    Quote Originally Posted by Norm
    I don't see how it would be open to malicious use.
    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.

  7. #7
    Member
    Join Date
    Feb 2012
    Posts
    58
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default Re: Java Online Compiler

    Quote Originally Posted by sb24 View Post
    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..
    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.

  8. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Online Compiler

    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.

  9. #9
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Online Compiler

    Quote Originally Posted by Norm View Post
    Also look at the javax.tools package. There is a class: JavaCompiler that could be useful.
    What does JavaCompiler do exactly?can you kindly give a simple example?
    i tried googling it but i did not understand the explanations.

  10. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Online Compiler

    Can you post the links you found?
    If you don't understand my answer, don't ignore it, ask a question.

  11. #11
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Java Online Compiler

    Online compilers already exist. See: ideone.com (btw, this covers many languages including java).

  12. #12
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Online Compiler

    Quote Originally Posted by Norm View Post
    Can you post the links you found?
    JavaCompiler (Java Platform SE 6)
    Java 2 Platform SE v1.3.1: Class Compiler

  13. #13
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Online Compiler

    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

  14. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: Java Online Compiler

    Sounds like it could be useful to some students.
    If you don't understand my answer, don't ignore it, ask a question.

  15. #15
    Junior Member
    Join Date
    Mar 2012
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java Online Compiler

    Quote Originally Posted by Norm View Post
    Sounds like it could be useful to some students.
    do you think it will count as a senior project? i'm given two semester to finished it.

  16. #16
    Super Moderator helloworld922's Avatar
    Join Date
    Jun 2009
    Posts
    2,896
    Thanks
    23
    Thanked 619 Times in 561 Posts
    Blog Entries
    18

    Default Re: Java Online Compiler

    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.

Similar Threads

  1. Creating a Compiler in Java
    By Superstar288 in forum Java Theory & Questions
    Replies: 20
    Last Post: February 22nd, 2013, 09:05 AM
  2. Which is the best place to get java tutorial online??
    By texsas12 in forum What's Wrong With My Code?
    Replies: 4
    Last Post: September 2nd, 2012, 07:45 PM
  3. Java 6.0 Compiler Error
    By jilomes in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 19th, 2011, 04:34 PM
  4. online system on java
    By u-khan1 in forum Paid Java Projects
    Replies: 0
    Last Post: March 8th, 2011, 06:02 AM
  5. How to set java compiler compliance with command under Linux
    By Eric97 in forum Java Theory & Questions
    Replies: 2
    Last Post: November 9th, 2010, 09:25 AM

Tags for this Thread