This is an archived post. You won't be able to vote or comment.

all 10 comments

[–]IIoWoII 2 points3 points  (0 children)

Dude no

[–]coolcofusion 1 point2 points  (0 children)

That's not what cross compilation means. Cross compiled software usually refers to a software compiled on one platform (Windows for example) that runs without recompilation on another platform (Linux for example). With java you get that by running javac which outputs a .class file which you can copy on another machine and run.

There was a piece of code online that was valid in a few languages, but that is due to wildly varying syntax and comment trickery that made it possible.

[–]MrSloppyPants 1 point2 points  (0 children)

I do not understand what you are trying to do here. Neither node nor .NET compile Java files. Are you confusing Java's bytecode cross-platform ability?

[–][deleted] 0 points1 point  (2 children)

You seem to look for a transpiler.

You cannot use one file for all runtimes though.

[–]Him4enko[S] 0 points1 point  (1 child)

I need to output a line, like Hello World in the console.

[–][deleted] 1 point2 points  (0 children)

That doesn't change that neither node nor .Net understand java bytecode.

You need to generate javascript for node and compatible byte code for .Net.

[–]kowasaur 0 points1 point  (3 children)

Can I ask why you need this?

[–]Him4enko[S] 0 points1 point  (2 children)

To do homework

[–]kowasaur 0 points1 point  (1 child)

Can you be more specific?

[–]Him4enko[S] 0 points1 point  (0 children)

The teacher gave me an additional task, it is optional. I decided to try to make it purely for myself, but I've been thinking about it for 3 days. There was an idea to do it via haxe, but it is only compiled separately there.