如何使用终端/ cmd编译java项目 [英] How to compile a java project with a terminal/cmd

查看:101
本文介绍了如何使用终端/ cmd编译java项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我厌倦了使用Eclipse,因为它过于简单和旧式。所以我转到了一个名为Sublime Text 3的程序,我使用了一个名为材料主题的软件包,它使程序看起来很平整而且很好用。

I got tired of using Eclipse because it was too "plain" and "old style". So I moved on to a program called Sublime Text 3 and I used a package named "material theme" which made the program look flat and all nice and stuff.

但是我我想在那里编写Java代码,但我不知道如何在不使用IDE的情况下编译内容并且不容易找到,但我发现你可以通过操作系统的终端/ cmd来完成。

But I wanted to code Java in that but I don't know how to compile stuff without using an IDE and it was not easy to find out but I found out that you could do it through the terminal/cmd of your operating system.

但我不明白的是我如何实际使用 javac 命令,这意味着Java Compile和我搜索了我没有找到,因为我无法理解在YouTube或Stack Overflow上发布的任何内容,因为我对整个终端/ cmd Java编译事物都不熟悉。

But what I don't understand is how I could actually use the javac command which means Java Compile and I searched and I didn't find out because I couldn't understand anything that was posted on either YouTube or Stack Overflow because I'm new to this whole terminal/cmd Java Compiling thing.

推荐答案

你差不多好了!

确保你拥有 Java开发工具包(JDK) )安装在您的系统中。 JDK为您提供命令 javac - 您需要编译 .java 程序文件。

Just be sure you have the Java Development Kit (JDK) installed in your system. The JDK provides you the command javac -which you need to compile your .java program files.

javac 命令并不像你想象的那么友好。你必须让它知道在哪里找到你想编译的java文件。

The javac command is not that friendly as you think it is. You have to let it know where to find the java file you want to compile.

例如你保存了 Main.java C:\Projects\Java 里面你必须这样编译 javac C:\ Project:\\ Java \ Main.java

For example you saved Main.java inside C:\Projects\Java you must compile it this way javac C:\Projects\Java\Main.java.

然后你也可以这样运行你的程序 java C:\ Project] \ Java \ Main

Then you can run your program this way too java C:\Projects\Java\Main

如上所述这里 ...你可以找到更详细的解释官方教程

As mentioned here... You can find a more detailed explanation to the official tutorial.

这篇关于如何使用终端/ cmd编译java项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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