Click here to Skip to main content
15,440,771 members
Home / Discussions / Java
   

Java

 
AnswerRe: Sending BufferedImage thought a socket Pin
jschell24-Oct-21 6:53
Memberjschell24-Oct-21 6:53 
GeneralRe: Sending BufferedImage thought a socket Pin
Valentinor24-Oct-21 21:40
MemberValentinor24-Oct-21 21:40 
GeneralRe: Sending BufferedImage thought a socket Pin
jschell23-Dec-21 5:29
Memberjschell23-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
MemberJoop Eggen 202125-Nov-21 6:15 
QuestionJava Programming Challenge Pin
Purvesh Ptdr24-Sep-21 18:22
MemberPurvesh 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
MemberMajid 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.
AnswerRe: java jshell beanshell eval string Pin
jschell5-Sep-21 8:55
Memberjschell5-Sep-21 8:55 
QuestionDefault Casting a column to type using Hibernate Pin
ficevivu3-Aug-21 19:50
Memberficevivu3-Aug-21 19:50 
QuestionHow to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 1:51
MemberMr.Corona13-Jul-21 1:51 
QuestionRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 2:37
mveRichard MacCutchan13-Jul-21 2:37 
AnswerRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 2:41
MemberMr.Corona13-Jul-21 2:41 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 2:46
mveRichard MacCutchan13-Jul-21 2:46 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 2:53
MemberMr.Corona13-Jul-21 2:53 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 3:04
mveRichard MacCutchan13-Jul-21 3:04 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 3:40
MemberMr.Corona13-Jul-21 3:40 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Richard MacCutchan13-Jul-21 5:02
mveRichard MacCutchan13-Jul-21 5:02 
GeneralRe: How to make a scrolling background for a JPanel in java? Pin
Mr.Corona13-Jul-21 17:55
MemberMr.Corona13-Jul-21 17:55 
QuestionHow to read a certificate from USB Token and Print It on Eclipse Console?? Pin
Member 150264029-Jul-21 0:59
MemberMember 150264029-Jul-21 0:59 
QuestionKnowing about jdk Pin
Ranjeet Singh from Unknown7-Jul-21 21:56
MemberRanjeet Singh from Unknown7-Jul-21 21:56 
AnswerRe: Knowing about jdk Pin
Richard MacCutchan7-Jul-21 22:08
mveRichard MacCutchan7-Jul-21 22:08 
QuestionJava Pin
Ranjeet Singh from Unknown7-Jul-21 21:54
MemberRanjeet Singh from Unknown7-Jul-21 21:54 
AnswerRe: Java Pin
Richard MacCutchan7-Jul-21 22:07
mveRichard MacCutchan7-Jul-21 22:07 
GeneralRe: Java Pin
Ranjeet Singh from Unknown7-Jul-21 22:12
MemberRanjeet Singh from Unknown7-Jul-21 22:12 

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.