BleepingComputer.com: How to use GCJ Java compiler

Jump to content


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.

Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to use GCJ Java compiler

#1 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,814
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 27 July 2009 - 12:50 AM

For some weird reason I had a thought, that I should compile java code into Windows native EXE using GCJ (GNU Java compiler)

I installed MinGW (again) selecting Java compiler. Now I wrote a simple Hello World java program:

public class Hello{  
	public static void main(String args[]){
		System.out.println("Hello, World!");
	}
}


and gave command line:

gcj Hello.java --main=Hello -o Hello.exe


This compiled and created Hello.exe. But when I run it, nothing is displayed. I searched MinGW site and nobody seems to have any problem.

What am I doing wrong ?
[url="http://www.avast.com/"]avast! free antivirus[/url]

#2 User is offline   groovicus 

  • Hail Groovicus!
  • PipPipPipPipPipPip
  • Find Topics
  • Group: Moderator
  • Posts: 9,522
  • Joined: 05-June 04
  • Gender:Male
  • Location:Centerville, SD

Posted 27 July 2009 - 07:59 AM

Are you trying to run it from the command line, or just double-clicking on it?
"Take the risk of thinking for yourself, much more happiness, truth, beauty, and wisdom will come to you that way" - Christopher Hitchens

#3 User is offline   Romeo29 

  • Learning To Bleep
  • PipPipPipPipPipPip
  • Find Topics
  • Group: BC Advisor
  • Posts: 2,814
  • Joined: 06-July 08
  • Gender:Not Telling
  • Location:127.0.0.1

Posted 27 July 2009 - 12:33 PM

From command line. From same command prompt used for compiling

Posted Image
[url="http://www.avast.com/"]avast! free antivirus[/url]

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users