ProgrammerHumor

helloWorldImSatan

helloWorldImSatan
https://i.redd.it/cj6djl7tg8cf1.gif
Reddit

Discussion

Agiwlesz

I have searched the codebase of my company (pretty large codebase). 2 files named JavaScript.java found!

2 days ago
big_guyforyou OP
:py:

so there is more than one satan

2 days ago
thonor111

Or satan only has one joke and has to repeat it multiple times

2 days ago
WhenInDoubt_Kamoulox

Satan: My Java program identifies as Javascript 🤣🤣 checkmate atheists 🤣🤣

2 days ago
FireMaster1294
:py:

Javascript.jar.js.exe

2 days ago
spryllama
:p:

The Satan is coming from inside the house!

2 days ago
TypicalArachnid08

cursed code detected. Exorcism scheduled

2 days ago
shnelya

they walk among us

2 days ago
LucaTheNativeSpeaker

Please don't confuse my AI assistant, otherwise I won't be able to fix it myself

2 days ago
YouDoHaveValue

Protect your code against upstart juniors with these simple tricks!

  • zero width characters

  • Obscure unicode (а vs a) characters in names.

  • Functions and statements that never run but will be included in analysis if (varThatisAlwaysFalse) {...}

  • preprocessing build flags that only evaluate in runtime

2 days ago
CoffeeKisser

The real Satan is always in the comments

2 days ago
Skylect

Thanks for telling it how it works! lol

1 day ago
Mr-Memelord420

Teach me how to write scripts in Java

2 days ago
big_guyforyou OP
:py:
console.log(`public class Test {
public static void main(String[] args) {
    System.out.println("Hello World");
    }
}`)
2 days ago
Mr-Memelord420

Im pretty sure you can go to jail for this

2 days ago
big_guyforyou OP
:py:
python_java_script = lambda: '''
console.log(`public class Test {
public static void main(String[] args) {
System.out.println("Hello World");
}}`)
'''
2 days ago
Hohenheim_of_Shadow

Jython script is a real thing and widely used in the automotive industry apparently

2 days ago
AceMKV
:py:

I mean Jython which is Python compiled to Java Bytecode has been around for as long as CPython I believe.

2 days ago
Carnonated_wood
:cp::kt::js::py:

Isn't CPython the default implementation? Correct me if I'm wrong

2 days ago
AceMKV
:py:

Yes it is

2 days ago
Nervous_Teach_5596

Yet no WebClient, neither WebResponse, HTMLPage and no page.executeJavaScript

2 days ago
JackNotOLantern

No, that is java in a script. Your should write something like

System.out.println("consol.log(\"this is a script\")");

And then redirect the standard output to a js executor

1 day ago
MagicalPizza21

Jascriptsva

2 days ago
lachsimzweifel

Not entirely sure this would work, but Jshell exists and it might be able to execute script like files.

2 days ago
SenorSeniorDevSr

It would, but you also have JEP 330: Launch Single-File Source-Code Programs

It's been around since Java 11, and is old as dirt. How have people not heard about this?

1 day ago
SenorSeniorDevSr

JEP 330: Launch Single-File Source-Code Programs

This would be a simple way. You could also use JShell + shebangs like a NormalPersonFactory.newInstance(), but where's the fun in that?

1 day ago
MagicalPizza21

How dare you start your class name with a LOWERCASE LETTER?

2 days ago
ZunoJ
:cs: :asm: :c:

It's the file name

1 day ago
MagicalPizza21

In Java, the file name has to match the class name, last I checked.

1 day ago
ZunoJ
:cs: :asm: :c:

Not if there are no public classes in the file

1 day ago
MagicalPizza21

Huh. TIL

1 day ago
Afsheen_dev

Lol this is so relatable! I've done that before and ended up with bunch of errors.

2 days ago
Nervous_Teach_5596

implementation ('org.htmlunit:htmlunit:4.13.0')

2 days ago
timothee_64
:cp:

Now reimplement it in JavaScript.

2 days ago
tfngst
:cs:

And wrote the code with actual Java script as in Javanese Java, Indonesia.

2 days ago
314159265358979326

I like using the name "monte_python.py" for personal scripts using monte carlo methods written in python. It's decidedly unproductive but amuses me.

2 days ago
SenorSeniorDevSr

You can also just call it script.java then run it using java script.java

This is all thanks to JEP 330, which lets you make Java eh... scripts.

1 day ago
8threads

This can happen if you’re using GWT.

2 days ago
lonelyroom-eklaghor
:c::j::py::re:

I need some Jshell up my arse

1 day ago
chat-lu
:rust: :elixir-vertical_4: :re: :clj: :py: :kt: :j: :bash: :js:

How is that weird? There is a full blown implementation of javascript in java.

1 day ago
SenorSeniorDevSr

Rhino is old and not really recommended. GraalVM is the current hotness.

1 day ago
ugotmedripping

I feel you could shorten it to js.java for efficiency

1 day ago
navetzz

The real joke here is scripting in java

1 day ago
cheezballs

Eh, I dunno that a Java file can be called a script. Maybe some, sure.

2 days ago
cibule249

u/savevideo

2 days ago
_terrapin

script.java

1 day ago
AppropriateStudio153

Class names should begin with a capital letter.

https://www.oracle.com/java/technologies/javase/codeconventions-namingconventions.html

If that class represents JavaScript, it's a good name.

5 hours ago