Click here to Skip to main content
15,907,281 members
Home / Discussions / Java
   

Java

 
AnswerRe: java program Pin
Richard MacCutchan11-Jan-22 2:40
mveRichard MacCutchan11-Jan-22 2:40 
AnswerRe: java program Pin
Member 1550241316-Jan-22 23:01
Member 1550241316-Jan-22 23:01 
GeneralRe: java program Pin
Pete O'Hanlon16-Jan-22 23:18
mvePete O'Hanlon16-Jan-22 23:18 
GeneralRe: java program Pin
Richard MacCutchan17-Jan-22 0:39
mveRichard MacCutchan17-Jan-22 0:39 
AnswerRe: java program Pin
Prashanth Rao 202118-Jan-22 23:18
Prashanth Rao 202118-Jan-22 23:18 
Questionhow do i properly connect my external style sheet link to my jsp page. Pin
jonathanIckovich25-Dec-21 19:42
jonathanIckovich25-Dec-21 19:42 
QuestionWhat is causing error in my merge sort java code? Pin
Vivek Halakatti3-Dec-21 5:20
Vivek Halakatti3-Dec-21 5:20 
AnswerRe: What is causing error in my merge sort java code? Pin
Richard MacCutchan3-Dec-21 6:09
mveRichard MacCutchan3-Dec-21 6:09 
QuestionWhat may be the error in this java ->merge sort code? Pin
Vivek Halakatti2-Dec-21 7:15
Vivek Halakatti2-Dec-21 7:15 
AnswerRe: What may be the error in this java ->merge sort code? Pin
Richard Deeming2-Dec-21 21:29
mveRichard Deeming2-Dec-21 21:29 
QuestionWhy am I getting an error concatenating a String in java 16? Pin
Toml61828-Nov-21 6:13
Toml61828-Nov-21 6:13 
AnswerRe: Why am I getting an error concatenating a String in java 16? Pin
Gerry Schmitz28-Nov-21 7:58
mveGerry Schmitz28-Nov-21 7:58 
QuestionRe: Why am I getting an error concatenating a String in java 16? Pin
Richard MacCutchan28-Nov-21 8:13
mveRichard MacCutchan28-Nov-21 8:13 
AnswerRe: Why am I getting an error concatenating a String in java 16? Pin
Toml61828-Nov-21 9:55
Toml61828-Nov-21 9:55 
Questionhelp with 2d cellular automata in JavaSwing Pin
Suave6519-Nov-21 9:10
Suave6519-Nov-21 9:10 
QuestionRe: help with 2d cellular automata in JavaSwing Pin
Richard MacCutchan19-Nov-21 21:55
mveRichard MacCutchan19-Nov-21 21:55 
QuestionSending BufferedImage thought a socket Pin
Valentinor8-Oct-21 2:10
Valentinor8-Oct-21 2:10 
AnswerRe: Sending BufferedImage thought a socket Pin
jschell24-Oct-21 6:53
jschell24-Oct-21 6:53 
GeneralRe: Sending BufferedImage thought a socket Pin
Valentinor24-Oct-21 21:40
Valentinor24-Oct-21 21:40 
GeneralRe: Sending BufferedImage thought a socket Pin
jschell23-Dec-21 5:29
jschell23-Dec-21 5:29 
AnswerRe: Sending BufferedImage thought a socket Pin
Gerry Schmitz25-Oct-21 8:35
mveGerry Schmitz25-Oct-21 8:35 
AnswerRe: Sending BufferedImage thought a socket Pin
Joop Eggen 202125-Nov-21 6:15
Joop Eggen 202125-Nov-21 6:15 
QuestionJava Programming Challenge Pin
Purvesh Ptdr24-Sep-21 18:22
Purvesh Ptdr24-Sep-21 18:22 
QuestionRe: Java Programming Challenge Pin
Richard MacCutchan24-Sep-21 21:19
mveRichard MacCutchan24-Sep-21 21:19 
Questionjava jshell beanshell eval string Pin
Majid Karimi27-Aug-21 23:45
Majid Karimi27-Aug-21 23:45 
In most of scripting/interpreting programming languages such as python or JavaScript, there is/are a/some method(s) to execute a string in runtime just like a code.
For example: eval("int i=5;");
those could have run the eval method inside the interpreting shell and even inside the input parameter of eval method recursively without a problem.
In jshell I found, inside the java host program after creating a jshell object we can call the eval, but what if I want to insert the eval inside the string and then run it in the jshell object.
For example:

JShell jsh=JShell.create();
jsh.eval("int j=4;");//current way of using eval in jshell hosted by another java or jshell program.

I need to do something like this:

JShell jsh=JShell.create();
jsh.eval("""
eval("int j=4;");
""");

or alternatively

JShell jsh=JShell.create();
jsh.eval("""
currentJShell.eval("int j=4;");
""");

or again alternatively

JShell jsh=JShell.create();
jsh.eval("""
currentJShell.eval("int j=4;");
""");

after some research, I found something like "/open" doesn't solve the problem for multiple reasons:
1- it's a part of interactive jshell utility/UI (provided (probably) by oracle(not sure))
not exactly jshell object
2- even if it is a part of jshell, still inside the guest jshell program, I can't call it
in a for loop or ... I have to type it with the keyboard and then hit enter.

for(int c=0;c<34;c++){/open <filename+c>}// it's not possible.

But in beanshell looks like ok just like python and JavaScript.
I have the same problem with csharp script.
Thanks for your time.
Sorry if this question is asked in the wrong spot. I am not very familiar with these types of q/a website.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.