通过bat文件运行课程 [英] Run class by bat file

查看:124
本文介绍了通过bat文件运行课程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经用Java创建了一个程序,然后在编译后给出了相应的.class文件,然后对其进行了编译,但是我的问题是我想在不使用cmd提示符的情况下运行它.我想通过使用.bat文件运行.class文件来运行它.

请帮助我.

I have created a program in java and then compile it gives after compiling it gives corresponding .class file but my question is I want to run it without using cmd prompt. I want to run it by using .bat file for run .class file.

Please help me.

推荐答案

如果使用批处理文件运行Java类文件,则需要为其创建.bat文件.
要创建.bat文件,请打开记事本,然后键入
In case of run java class file by using batch file you need to create .bat file for it.
For create .bat file open Notepad and then Type
Java classname
pause


然后将其另存为filename.bat
现在,当您单击filename.bat文件时,它将运行并在控制台窗口中提供输出.


And then save it as filename.bat and
now when you click on filename.bat file it run and gives output in console window.


创建一个包含正确的Java调用的.BAT文件,例如:
Create a .BAT file that contains the correct java call, something like:
@echo off
java -c [your classpath] ClassToRun


这篇关于通过bat文件运行课程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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