Sorry for the stupid question, I'm just beginning to learn Java. Can it be compiled into a .exe to be run on another computer, or is it only f开发者_运维知识库or computers with a JVM?
Not exactly. You can bundle a JRE with your executable, which is kind of like the same thing. Embedding a JRE is one approach offered by launch4j.
There are third party projects that will allow you to do this. A free one is http://gcc.gnu.org/java/ . I don't believe it's officially supported by Java though, but it's also gnu, who happen to know a thing or two about compilers.
There is also http://www.excelsior-usa.com/jet.html which is a paid product, but supports up to Java 6.
Can you make candy without sugar?
Yes, you need to have a JVM (just the executing for compiling) to run and to compile. Although, it is not necessary when trying to write just the code.
精彩评论