hello all
how to make window's short cut that call command line:
java javaclassname.java

thank you

Recommended Answers

Did you mean
javac javaclassname.java
java javaclassname

Jump to Post

All 4 Replies


I mean :
java javaclassname

thank you

I guess you could create a on-line .bat file containing that command, but that hardly seems worth the bother, and doesn't lead on to anything useful. As you build your java skills you will start using some kind of IDE to compile and test code, and you will start packaging your applications into .jar files which can be double-clicked to run them by default.

The trick with making a batch file to execute a single java class file is to use the right variable name in the batch file that picks up only the file name.
I think it is something like: %~n1

This would allow you to set the RightClick context menu to call the batch file when you click on a class file and execute the class file with the java command.
Here is the contents of a batchfile I use:
@REM Execute a java class file
java.exe %~n1

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.