Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Pro Java
|
Pro Java Expert level Java questions not about a specific book. Please indicate your version.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro Java section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 28th, 2007, 08:44 AM
Registered User
 
Join Date: Sep 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Java without runtime?

Is it possible to just write a Java program without using the Runtime behind it?

I.E. compile it straight to Machine Code like you would a C++ program?
_________________
Parental control software free parental control software
 
Old September 28th, 2007, 11:34 AM
Registered User
 
Join Date: Sep 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The concept of Java is to execute code without being specific to a platform. If you compile your code into machine code, then it will only execute in the platform which you compiled it, and compatible ones. This goes against the philosophy of Java, "Write once, run anywhere".

So, there is no way to compile your Java code to machine code (as far as I know). Even if you did that using some code conversion tool, then it wont be "Java" anymore. :)


The plus points of Java (like platform independence, security - through sandbox) and all other dependencies (libraries, thread management) are provided by the JVM. Without JVM, it will not be possible to achieve those.

Regards.

- Yohan


 
Old October 1st, 2007, 05:29 AM
Friend of Wrox
 
Join Date: Dec 2003
Posts: 488
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Its possible, but a bad idea as yohan has mentioned. See the gcj project, http://gcc.gnu.org/java/index.html for a *nix implementation.

--
Charlie Harvey's website - linux, perl, java, anarchism and punk rock: http://charlieharvey.org.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Root Cause:java.lang.NoSuchMethodError: java.util. anees81 JSP Basics 3 March 1st, 2011 08:55 AM
Java without runtime? MOON22 Java Databases 1 October 24th, 2007 04:42 AM
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM
java.lang.Runtime mudasirw J2EE 1 August 2nd, 2005 02:14 AM
Java 2 Runtime conflict possible James 1950 Java GUI 0 April 11th, 2004 06:40 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.