The Artima Developer Community
Sponsored Link

Java Answers Forum
Can I compile source codesusing a JAVA CODE

3 replies on 1 page. Most recent reply: Mar 4, 2004 3:16 AM by Joe Parks

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
silly ivy

Posts: 7
Nickname: akane
Registered: Mar, 2004

Can I compile source codesusing a JAVA CODE Posted: Mar 2, 2004 7:18 AM
Reply to this message Reply
Advertisement
I am making a thesis.... And im using JSP, JAVA and MySQl, I am looking for a source code that can compile a java source code in a click of a button. Is that possible?


Mahadevan

Posts: 1
Nickname: devan
Registered: Mar, 2004

Re: Can I compile source codes using a JAVA CODE Posted: Mar 3, 2004 2:00 AM
Reply to this message Reply
Yes you can write a batch file which contains as follows

javac filename.java
or
javac args[0]

then save with batchfilename.bat
run as
batchfilename.bat

Sunitha C S

Posts: 20
Nickname: sunics
Registered: Dec, 2003

Re: Can I compile source codesusing a JAVA CODE Posted: Mar 4, 2004 2:48 AM
Reply to this message Reply
import java.io.*;
class JavaTest
{
public static void main(String[] args)
{
try
{ Runtime rt= Runtime.getRuntime();
Process p = rt.exec("Dir"); // here u can do what ever dommand line execution...
//OutputStream op =p.getOutputStream();
InputStream ip = p.getInputStream();
}
catch(Exception IOException )
{

}
}
}

I hope this helps you....if you need more info let me know

Regards,

Sunitha

Joe Parks

Posts: 107
Nickname: joeparks
Registered: Aug, 2003

Re: Can I compile source codesusing a JAVA CODE Posted: Mar 4, 2004 3:16 AM
Reply to this message Reply
If you want to be platform independent, you could stick ant.jar on the classpath and use this post as a starting point:
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=666b3122.0202181224.174231ca%40posting.google.com&rnum=3

Flat View: This topic has 3 replies on 1 page
Topic: Get string from icon and string list Previous Topic   Next Topic Topic: How To Continue With The Code for Profit and Loss Program

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use