E
E
eagle2016-01-10 18:55:33
linux
eagle, 2016-01-10 18:55:33

How to bind Java interpreter to a script in Linux?

This video shows an example of creating scripts in Linux.
The example is shown for the internal linux and ruby ​​interpreter.
The question arose: is it possible to create similar scripts in Java?
If so, which interpreter should I specify for Java? java or javac? or what else? And in what form then to write a script? Inside a single class?
The bottom line is that if you just specify java, it won't find the class.
Those. As far as I understand, you need to make a script that will immediately create a class and execute it.
How to do it?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg Tsilyurik, 2016-01-10
@Olej

Those. As far as I understand, you need to make a script that will immediately create a class and execute it.

I didn't go deep into your intent and didn't really understand the purpose of it... but
- creates a class (compiles java source code into bytecode) javac command
- executes JVM bytecode (.class), java command
- by combining these commands you can make yourself a script.

S
sivabur, 2016-01-10
@sivabur

javac main.class
java main
It?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question