Is it possible to run a Java program with JVM only? - jvm

Is it possible to run a Java program with JVM only? (without JRE)
I don't ask if we can run all the programs, also those that needs access to libraries, I'm asking for the most basic program, after the program was compiled
(Is there a program that can run with only JVM)

You cannot run the program without JRE. But you can run the program without JDK, if the program is already compiled.
Java Runtime Environment (JRE) is a software package that contains what is required to run a Java program - Wikipedia

Please look at the picture below you will better understand how java works:CLICK HERE
Java Runtime Environment contains JVM, class libraries, and other supporting files. It does not contain any development tools such as compiler, debugger, etc. Actually JVM runs the program, and it uses the class libraries, and other supporting files provided in JRE. If you want to run any java program, you need to have JRE installed in the system.

Yes, You would need a wrapper to make the file executable. target environment would not require java runtime installation in this case. to be clear you are embedding the JRE inside. have look at Excelsior JET

Related

Can I build a windows executable from kotlin source code?

As far as I know, kotlin native allows you to compile kotlin source code to platform specific nativ code, that runs without any virtual machine.
But I don't seem to find any example on how to build a windows executable (.exe) from kotlin source code.
Why is that?
Can you do it or not?
https://kotlinlang.org/docs/native-get-started.html shows you how to set up a basic Kotlin Native project, and compile it. The only note is that kotlin native will generate a .kexe, which is just a renamed .exe.

Which Kotlin download do I need?

I'm getting started with Kotlin, and on the downloads page I see two different possibilities that look relevant for me:
kotlin-compiler
kotlin-native-windows
What's the difference? In what case would I need one or the other?
Most probably you won't use CLI to compile, build and run Kotlin projects a lot. Well, maybe you'll need a standalone compiler a few times compiling "Hello world" when starting with this language. BTW, you can use https://try.kotlinlang.org to compile simple programs and play with the language without local installations.
But as you proceed, it won't be enough. Most Kotlin projects today use either Gradle or Maven. Gradle scripts could be written in Kotlin themselves. I recommend you taking this extra step and use build tools instead of standalone compiler, as it will simplify a lot if things in future. IntelliJ IDEA, the most popular IDE for Kotlin made by JetBrains, the company behind Kotlin, allows you to create Gralde-based Kotlin projects in a few clicks.
Kotlin is a multi-platform language. It can be compiled to produce binaries compatible either with:
Java
JavaScript
A native platform (Windows, Linux, iOS, etc.)
Which compiler you should choose depends on your needs. If you don't need to make your code operate with a C library or a specific OS tool, I'd recommend the kotlin-compiler, so you'll get an app executable through Java, which (at least for now) produce more optimized programs, and also easily portable (install a jre on target computer and you're ready to execute your Kotlin program). Plus, you'll be able to use any Java lib you need in your kotlin program.
Note : Official documentation contains guides to get started:
Command line compiler for JVM
Command line compiler for native executables

Retrieve Nuget Package Manager file in my java program (IntelliJ)

I got a dll file with an extension .nupkg from my .Net developer team mate which I need to use in my java program. How do I go about it? I use intellij.
A nupkg is just a zip file so you should be able to unzip it and see what it contains.
You can also take a look at the JNI (Java Native Interface, google or Wikipedia can tell you more), which lets you call out from Java to other languages. This isn't trivial though.

OSGI aware IDE at development time

I'm starting development using OSGi but when one of my concerns is about the lack of support at development time, meaning that commonly IDEs (started using Intellij IDEA) don't use OSGi for class discovery but classpath search IDE managed (I'm in search for one that uses OSGi instead).
The main concern here is to prevent classpath issues at execution time by suing the same OSGi mechanisms at development time.
Does any IDE work this way ?
update: added link to blog post with my experience with IDEA
OSGi is a runtime technology, therefore there is no such thing as an OSGi mechanism at build time. Also bear in mind that ultimately all Java code must be compiled by a Java compiler, usually javac. The javac compiler does not use package dependencies like Import-Package, it always uses JARs or directories on the classpath.
Having said that, Bndtools uses package filtering at build time, based on the exported and private packages of the dependencies. This is a special feature of Eclipse and it does not work when you compile outside of the IDE, e.g. with Ant or Maven. However it may still be useful because if you try to use a non-exported package from another bundle you will get a problem marker with a red X in the Eclipse IDE.

Which IDE should i use for Google's Native Client?

I'm planning to try out Google's NaCL. Which IDE should i use for developing? It would be nice to be able to compile the project from the IDE and run it in Chrome. Some basic debugging would be also very useful.
We do not have any IDE support yet. You can try Eclipse (with CDT) + Standard Make C or C++ project to automate compilation. Launching and debugging will not be possible from Eclipse.
Alternatively, you can use any editor with syntax highlighting and compile/launch by hand from cmd/bash.
Debugging on NaCl is very tricky by itself. There is no sane way to do this now.
You can use NACL_EXE_STDOUT and NACL_EXE_STDERR environment variables (set them to absolute paths to files where stdout and stderr of NaCl program will be written) plus --no-sandbox chrome flag for debug printf's.
Update (March 2014)
We have Visual Studio plugin now which can be installed with naclsdk update vs_addin. See also: https://developers.google.com/native-client/dev/devguide/devcycle/vs-addin
Also, I created a page that describes how to use Eclipse with CDT to compile and debug NaCl applications: http://www.chromium.org/nativeclient/how-tos/debugging-documentation/debugging-with-debug-stub-recommended/debugging-nacl-apps-in-eclipse-cdt