LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 09-07-2006, 08:55 AM   #1
halfpower
Member
 
Registered: Jul 2005
Distribution: Slackware
Posts: 241

Rep: Reputation: 31
Compiling "HelloWorld.java" on Slackware 10.2


I have the following java program on my hard drive

Code:
public class HelloWorld { 

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

}
I've tried typing the command
Code:
$ gcj HelloWorld.java
but all I get is this
Code:
$ gcj HelloWorld.java
/usr/lib/gcc-lib/i486-slackware-linux/3.3.6/../../../crt1.o(.text+0x18): In function `_start':
../sysdeps/i386/elf/start.S:115: undefined reference to `main'
collect2: ld returned 1 exit status
This is simple code. Can anyone tell me why it is not compiling?
 
Old 09-07-2006, 09:33 AM   #2
Youri
Member
 
Registered: Oct 2004
Distribution: slamd64-current, slackware-current, clfs 6.1, arch-current, ubuntu dapper
Posts: 144

Rep: Reputation: 15
try
Code:
$ gcj HelloWorld
 
Old 09-07-2006, 09:54 AM   #3
scoban
Member
 
Registered: Nov 2004
Location: Turkey
Distribution: Slackware
Posts: 145

Rep: Reputation: 16
Specifiy the main class by --main=HelloWorld

gcj --main=HelloWorld Helloworld.java
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
When "function pointer" meets "template"... I can't get rid of this compiling er cyu021 Linux - Software 3 12-17-2004 07:52 PM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM
I cannot use "java chat". Browser says plugin required "x-java-vm". jdruin Linux - Software 4 04-18-2004 05:44 PM
Compiling KDE 3.2.0 - "Can't open perl script "/dcopidlng/kalyptus" linuxgamer09483 Linux - Software 3 04-09-2004 08:25 PM
Java does "age" or "Age" matter when declaring an Int?? Laptop2250 Programming 3 10-13-2003 12:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:45 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration