answersLogoWhite

0

How do you run java?

User Avatar

Anonymous

13y ago
Updated: 8/16/2019

1. open cmd

2. type CD location, location being the folder the .class file is in

3. type java name, name being the name of the .class file

or :

here is a program i wrote. put it in the same directory as the class file.

you must copy and paste this into notepad and save it as anything.bat:

@echo off

SetLocal EnableDelayedExpansion

color fc

title java starter made by phirana lord

:start

set fileTest=0

cls

echo files in this directory:

echo.

dir "*.class" > temp.tmp

For /F "skip=4 tokens=5" %%I IN (temp.tmp) DO (

if "%%I"=="free" (

REM do nothing

) else (

set file!fileTest!=%%I

set /a fileTest=!fileTest!+1

echo %%I

)

)

del temp.tmp

echo.

echo.

echo.

echo.

set input=

set /p input=enter the name of the file you want to run:

if ""=="" (

goto start

)

if ""=="/debug" (

@echo on

goto start

)

if ""=="/exit" (

goto eof

)

set testnum=0

:testing

Call set testvar=%testnum%%%

if ".class"=="" (

goto run

)

if==(

goto err

) else (

set /a testnum=+1

goto testing

)

:err

cls

color 0c

echo error:

echo file.class not found in directory

echo fix this error by:

echo check your spelling

echo check if the file is in the same directory as this program

pause

color fc

cls

goto start

:run

cls

java

echo.

echo.

echo proccess complete

pause > nul

cls

echo press enter to quit

echo.

echo type rerun to restart your app

echo.

echo type restart to restart the program

echo.

echo.

echo.

echo.

set input2=

set /p input2=

if "%input2%"=="rerun" (

goto run

)

if "%input2%"=="restart" (

goto start

)

goto eof

:firstrun

echo indev >> ussettings.inf

:eof

exit

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

Do you have to have java on your coumpter to run everything on your coumpter?

No; lots of programs run without Java. You only need the Java runtime to run programs specifically designed with Java technology.


Which brands of laptops can run JAVA?

Any computer (desktop or laptop) can run Java.


How do you run and compile a java applet program?

One can run and compile a Java applet program by agreeing to the terms and downloading it. It is possible to get a compiler online that will compile and run Java programs.


Is java needed to run PC?

No, Java is needed only if you run programs that are written in Java. The majority of computer users today could disable Java and never know the difference.


How do you run minecraft.jar in puppy Linux?

You need to have Java installed, then just run "java -jar minecraft.jar".


Is it possible to run java program without JVM?

No. Java programs run in the Java Virtual Machine (JVM) - without it your computer won't know how to handle Java bytecode.


Do Android phones run java apps?

They cannot use Java apps themselves, though the programming language they run- Dalvik- is closely related to Java.


Can the Nintendo 3DS run Java?

Currently, the 3DS has no Java compatibility.


How do you execute a Java program?

You can run a Java application from the command line using "java <name of the class>"


What will java software do for you on your laptop?

The general Java Runtime Environment allows a computer to run Java applets and compiled Java files.


How many devices currently run Java?

As of 2021, it is estimated that over 3 billion devices worldwide run Java.


What is needed to run java?

You must have the Java Run-time Environment installed on your computer. Steps: 1. Open Command Prompt 2. Enter the command: javac class.java 3. Enter the command: java <classfilename> (without the .java or .class extension) The javac command will compile your java source file and create a class file. The java command will execute or run your java class file.