• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Bear Bibeault
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • salvin francis
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Jj Roberts

Is there any java equivalent of .csx files as in C#?

 
Ranch Foreman
Posts: 2061
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In C# there is a concept of .csx files. Is there any java equivalent of .csx files as in C#? If not so then why?
 
Marshal
Posts: 3258
487
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What are .csx files, and when are they used with C#?
 
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Ron McLeod wrote:What are .csx files, and when are they used with C#?


I don't know much about them, but they appear to be C# script files.

Monica Shiralkar wrote:Is there any java equivalent of .csx files as in C#? If not so then why?


I'm not familiar with how one might use a csx file, but if it's a script, maybe JShell would work.
 
Monica Shiralkar
Ranch Foreman
Posts: 2061
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What are .csx files, and when are they used with C#?



I looked at the code for creating an azure function (serverless) . In C# they have mentioned the save it as .csx file (instead of .cs file). However, in java it is saved at .java only.
 
Knute Snortum
Sheriff
Posts: 7108
184
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, you can save a JShell session as a .jsh file and execute it with JShell, but I'm not sure what this gets you.  What are you trying to accomplish?
 
Saloon Keeper
Posts: 22788
153
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I'm not even sure why csx files exist in Windows, much less why anything like them is so important on other OS's.

From the sound of it, a close equivalent might be Groovy.

But in truth, I kind of suspect that a lot of the reason for .csx is that until PowerShell came along, the Windows command shell/scripting environment was very, very feeble.

In contrast, the Unix and Unix-like OS's have always had very powerful shells and a rich set of support tools such as grep, sed, awk, perl, and the like plus frameworks like Tcl. And more recently, Python, among others. Most of these can be acquired for a Windows machine, but in the *n*x OS's, you can consider them as standard and not have to pull them in from third-party sources.
 
Rancher
Posts: 113
8
Mac Mac OS X Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is a Roslyn based interpreter that lets you do REPL based programming in C# similar to other REPL languages. CSX files are used with csi.exe which is the interactive C# REPL.  There is a window in Visual Studio called "C# Interactive" that lets you run this as well.   If you want to interactively program with a REPL, use csx files. OR if you want to make quick snippets to interact with both your Visual Studio and as a command line.

https://msdn.microsoft.com/en-us/magazine/mt614271.aspx
https://www.red-gate.com/simple-talk/dotnet/net-development/going-interactive-c/

In the .NET world, lots of people still use LINQPad to do ad-hoc exploration and execution in .NET languages. But this was because there was no REPL to do quick, ad-hoc programming. However LINQPad is God-like when you are exploring data interactively.


CSX files are not a replacement for Powershell or a replacement for the old Windows Scripting Host(VBScript or JScript)
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic