我知道这个问题已经流传了很长时间......
Xcode 4 中的 Java.
我不需要任何建议(Eclipse、Netbeans 例如),我只想在“XCode4”(而不是 3)中编译一些简单的 Java 代码。我设法创建了一个文件,正如预期的那样,语法和一切正常,但编译器由于缺少方案而无法正常工作。我有点被可执行文件困住了。
我的问题是:
可以这样做吗?
可以这样做吗?
是的,这是可能的。
1) File > New > New Project > Other > External Build System
2) Give it some name and save it somewhere.
3) File > New > New File > Other > Empty
4) Give it a Java-friendly name. In my example, use "HelloWorld.java"
5) Copy the contents below into the file and save.
6) File > New > New File > Other > Empty
7) Save as "Makefile".
8) Copy the contents below into the file and save.
9) The "Run" (>) button should at least compile your Java now.
现在事情变得棘手了。您不必执行下一部分。如果需要,您可以打开项目目录的终端并运行“java HelloWorld”。我强烈建议这样做。您也可以只输入“make”并将 Xcode 纯粹用作文本编辑器。
9) Project > Edit Scheme > Debug > Info
10) Executable > Other > type ^⌘g > type "/bin" > choose "sh"
11) Arguments
12) Set "Base Expansion on" whatever you named your target
13) Add an argument '-c "/usr/bin/java -classpath $(PROJECT_DIR) HelloWorld"' for this example.
14) Cross your fingers
15) Click the "Run" (>) button.
摘自
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)