Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
Calling javac from a Java program

 
Post new topic   Reply to topic Printable version
 View previous topic  <py> to java applet Post :: Post <py> Hypertension (Game)  View next topic  
Author Message
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:36
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Fri Mar 23, 2007 11:48 am    Post subject: Calling javac from a Java program Reply to topic Reply with quote

We have a group project in my Java class, and the final product is going to be able to open, display, edit, and save text files. So I thought it would be easy to add a button or a menu option that would make a call to javac with the filename of the file that's opened in the text displayer, but all I found was this: http://www.javaworld.com/javatips/jw-javatip131.html . Which should be exactly what I'm looking for. It discusses a class called com.sun.tools.javac.Main , which has a function compile(), which takes arguments like the command-line javac. But import com.sun.tools.java.Main; doesn't work, because apparently the package doesn't exist. A quick look at the original site, and I see they're discussing JDK 1.2. Now, is there a way to load that package even though it's from an older JDK?

I also tried com.sun.tools.javac.Main.*;, and that didn't work either. I googled the class name, and the closest thing I got to any help is this: http://forum.java.sun.com/thread.jspa?threadID=544470&messageID=2645708 . But, I don't understand that. Mainly, I don't understand this: "put the tools.jar available in jdk\lib directory on the classpath" . I guess that's a suggestion to change the CLASSPATH environment variable(which I currently have set to "."), but I don't understand exactly what to put there. Anyway, if any of you know how to use this class, or know of a better class to use, please tell me. In the mean time, I figure it can't be TOO hard just to call javac in a natural way(I assume Java is capable of running commands, I just don't know how), but at the moment, every site I come to seems intent on teaching me how to call an external program, and a bunch of other stuff all at once, in the same code, and I haven't been able to sort through it yet. :(
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:36
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Fri Mar 23, 2007 11:59 am    Post subject: Reply to topic Reply with quote

On the other subject - calling an arbitrary program from a Java program - I have found this: http://www.daniweb.com/techtalkforums/thread7710.html . I haven't had a chance to test it out yet, but I'm posting it here in case anyone else is looking into the subject.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Mar 24, 2007 8:15 am    Post subject: Reply to topic Reply with quote

A <10 second google search:

http://www.devdaily.com/java/edu/pj/pj010016/pj010016.shtml
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Non-Subspace Related Coding All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 683 page(s) served in previous 5 minutes.

phpBB Created this page in 0.419968 seconds : 28 queries executed (94.4%): GZIP compression disabled