如何使用Mac OS X在Sublime text 2上编译JAVA? [英] How to compile JAVA on Sublime text 2 using Mac OS X?

查看:228
本文介绍了如何使用Mac OS X在Sublime text 2上编译JAVA?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方案

我已经在互联网上查找了很复杂的结果,现在不知道该怎么做。 Sublime text 2已内置Java支持:





这意味着一旦打开Java源代码,您只需按 command + B






您在评论中描述的内容有点不同 - 您应该使用此信息更新您的帖子!



Devin发布了一个gist解决方案,这里



您应该通过以下菜单添加新的构建系统:



工具 - >构建系统 - >新构建系统



并添加以下json并将其保存为Java.sublime-build到默认目录(类似:〜/ Library / Application Support / Sublime Text 2 / Packages / User / ):

  {
cmd:[javac,$ file_name],
cmd:[java,$ file_base_name],
working_dir:$ {project_path:$ {folder }},
selector:source.java
}

下次您要编译&请从您的构建系统中使用Java.sublime-build。


I've looked all over the internet only finding very complicated results and now im not sure what to do.

解决方案

Sublime text 2 has builtin Java support:

Which means that once you have opened the Java source, all you have to do is press command+B


What you described in the comments is a bit different - you should update your post with this information!

Devin posted a gist solution here:

You should add a new build-system by going to the menu:

Tools --> Build System --> New Build System

and add the following json and save it as "Java.sublime-build" into the default directory (which is something like: ~/Library/Application Support/Sublime Text 2/Packages/User/):

{
    "cmd": ["javac", "$file_name"],
    "cmd": ["java", "$file_base_name"],
    "working_dir": "${project_path:${folder}}",
    "selector": "source.java"
}

Next time you want to compile & run use "Java.sublime-build" from your build-systems.

这篇关于如何使用Mac OS X在Sublime text 2上编译JAVA?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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