Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Virtual-PC & Java problem



On Tuesday, November 26, 2002, at 10:43 AM, Jim Cushing wrote:

Instead of exec()'ing javac, why not call sun.tools.javac.Main? Call the main() static method, passing in String[] array with the same arguments you'd pass in from the command line. It might not only solve your problem, but it'll probably be a bit faster, as well.

I have a version that does just that. It works fine on Mac. On Windows it will fail unless you place the sdk's tools.jar file in the classpath. I was hoping to avoid having the user set where that file was located. As another poster pointed out it has been deprecated. It is definitely not part of the standard API.


If that doesn't fix the problem, or you have another reason to stick with the exec() method, I suggest you getInputStream() (which is actually the Process's stdout stream) and getErrorStream(), read from them (you'll need a separate thread for each), and output their contents to the console to debug what's going wrong.

Do this also because I need to display compiler errors to the user. Nothing comes back. Just hangs.


If I can track down the source code to a little app I wrote about two years ago, I'll share it with you. It demonstrates both calling sun.tools.javac.Main and reading from the Process stdout and stderr (since it ends up running the code that it compiles).

One last suggestion regarding Virtual PC: I've had my image become corrupt several times, usually after Virtual PC reports and error and quits. Fortunately, this has not happened to me recently (perhaps the latest update from Connectix solved this), so I don't remember the exact proceed I went through. But as far as I can remember, I'd re-run the VPC installer, then re-run the updater, and I'd be able to access my existing disk image again, without having to re-install Windows or any of my other Windows software. I think one time, that was not sufficient, and I ended up uninstalling VPC, but even then, my disk image survived.

Thanks for the tip.


I hope some of this helps!

On Tuesday, Nov 26, 2002, at 11:17AM, Bill Tschumy <email@hidden> wrote:

I use Virtual-PC with Win2000 for testing my Java apps on Windows.
Recently my Virtual-PC image became corrupt and I decided to reinstall
it. After the reinstall my app that used to run fine now fails when
using exec() to invoke the javac compiler (the app is a simple
development environment). I've spent a day trying to track this down
and have now turn to this list in hopes that someone has an idea what
might be wrong. The app does still work correctly on a true Windows
machine.

In the stripped down version that fails, I basically exec() "javac"
with no args, get the process and do a process.waitFor(). This hangs
forever with the processor spinning. Invoking javac from the command
line works fine. I have tried substituting other Windows executables
for "javac" with the same result.

Anyone ever run into something similar? I think I've gotten my system
set up as before, but there must be something I have different.
--
Bill Tschumy
Otherwise -- Austin, TX
email@hidden
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.




--
Bill Tschumy
Otherwise -- Austin, TX
email@hidden
_______________________________________________
java-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/java-dev
Be sure to read the FAQ http://developer.apple.com/java/faq/ before posting
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Virtual-PC & Java problem (From: Jim Cushing <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.