What about loading and saving scripts?
I created a file myshell.txt with this content:
class MyClass {The help shows the following:
private int a;
public MyClass(){a=0;}
int getA() {return a;};
void setA(int var) {a=var; return;}
}
MyClass ZZ;
ZZ = new MyClass();
ZZ.setA(200);
-> /help /openso i tried this one:
|
| /open
|
| Open a file and read its contents as snippets and commands.
|
| /open
| Read the specified file as jshell input.
-> /open myjshell.txthmmm. No feedback inside jshell. But no news is good news:
-> /listSaving your work is quite easy:
1 : class MyClass {
private int a;
public MyClass(){a=0;}
int getA() {return a;};
void setA(int var) {a=var; return;}
}
2 : MyClass ZZ;
3 : ZZ = new MyClass();
4 : ZZ.setA(200);
-> /help /saveAnd also no news is good news:
|
| /save
|
| Save the specified snippets and/or commands to the specified file.
|
| /save
| Save the source of current active snippets to the file.
|
| /save all
| Save the source of all snippets to the file.
| Includes source including overwritten, failed, and start-up code.
|
| /save history
| Save the sequential history of all commands and snippets entered since jshell was launched.
|
| /save start
| Save the default start-up definitions to the file.
-> /save myjshell2.txtand like expected:
$ cat myjshell2.txtBut what about this /save start
class MyClass {
private int a;
public MyClass(){a=0;}
int getA() {return a;};
void setA(int var) {a=var; return;}
}
MyClass ZZ;
ZZ = new MyClass();
ZZ.setA(200);
-> /save start myjshell3.txtand the content of this file is:
$ cat myjshell3.txtTo load a scipt on startup just type
import java.util.*;
import java.io.*;
import java.math.*;
import java.net.*;
import java.util.concurrent.*;
import java.util.prefs.*;
import java.util.regex.*;
void printf(String format, Object... args) { System.out.printf(format, args); }
jshell myjshell.txt
Fascinating blog! Is your theme custom made or did you download it
ReplyDeletefrom somewhere? A theme like yours with a few simple tweeks would really make my
blog jump out. Please let me know where you got your design. With thanks