Jump to content
xisto Community
Sign in to follow this  
kvarnerexpress

Compile Java From Java

Recommended Posts

I have a program that was originally developed on a linux box and had a perl script to compile all the packages and classes, sign it and upload it.I'm now using a Windows machine and obviously the perl script doesn't work and I need a way to compile, sign and upload oll these files.I tried to make a .cmd file that would simply automate runnig commands at a DOS prompt, but it wasn't very flexible and somehow managed to find compile errors as the compiler couldn't find the packages listed in the java files beginning with com...I'm now trying to write a java app that compiles, signs and uploads the other program. At the moment I'm stuck on trying to get the new java app to create and send a command to compile the other program.This all proabably sounds very confusing, but please help if you can. Thanks.

Share this post


Link to post
Share on other sites

I'm now using a Windows machine and obviously the perl script doesn't work and I need a way to compile, sign and upload oll these files.

Why wouldn't the perl script work? Have you tried ActivePerl? Most perl scripts work across platforms. And if ActivePerl doesn't work you could try installing Cygwin, where you get a more complete UNIX/Linux-like environment (including perl) on a Windows-system.

I'm now trying to write a java app that compiles, signs and uploads the other program. At the moment I'm stuck on trying to get the new java app to create and send a command to compile the other program.

I would suggest using a proper build tool. In the case of Java development Apache Ant is the standard. It has the ability to compile, sign and upload - just what you need...

Share this post


Link to post
Share on other sites

I don't know what exactly you mean by "sign and upload," but you can compile stuff from java like so:

String s = JOptionPane.showInputDialog("What file?");Process p;try {     p = Runtime.getRuntime().exec("javac "+s);} catch(IOException e) {     //you can get the error somehow, check http://java.sun.com/j2se/1.4.2/docs/api/java/lang/Process.html}

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.