在小程序或 Google AppEngine 中托管 Java 编译器? [英] Hosting the Java compiler in an applet or in Google AppEngine?

查看:36
本文介绍了在小程序或 Google AppEngine 中托管 Java 编译器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网上搜索我发现Javac 编译器是用Java 编写的,而且我还查看了Sun 站点上的源代码.来源相当大,我无法取得任何进展.Eclipse 项目也有一个内嵌的编译器,但谁能触及它的源代码;-)

Searching the web I've found that the Javac compiler is written in Java, and I also peeked at the source on Sun's site. The source is quite big and I couldn't make any headway on it. Also the Eclipse project has a compiler embedded inside, but who could touch its source code ;-).

所以我想我会问你几个问题:

So I thought I'd throw a couple of questions your way:

  1. Java 编译器可以托管在 Applet 中吗?
  2. 能否让 Java 编译器在 GAE 上工作,并从数据存储动态加载生成的类文件?

推荐答案

是的,这样的编译器实际上只是一个普通的 Java 应用程序(除了它通常带有自己的本地启动器,但这不是必需的).

Yes, the compiler as such is really just a normal Java application (except that it usually brings its own native launcher, but that's not required).

因此您可以轻松地在 Applet 或 GAE 中运行它.

So you can easily run it within an Applet or inside GAE.

然而这并没有太大帮助,因为如果您想实际运行生成的类,那么您需要使用 ClassLoader 实例,它是不允许在(未签名的)Applet 中并且可能不允许在 GAE 中.

However that won't really help too much, because if you want to actually run the produced classes, then you'd need to play with ClassLoader instances which is not allowed in (unsigned) Applets and probably not allowed in GAE.

这篇关于在小程序或 Google AppEngine 中托管 Java 编译器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆