jQuery in Action, 3rd edition
The moose likes Beginning Java and the fly likes Problem with running java complier Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Problem with running java complier" Watch "Problem with running java complier" New topic

Problem with running java complier

craig connell

Joined: Sep 21, 2010
Posts: 9
Hi, I'm trying to get the first small program (party) in "Head first java" to work in the javac compiler. This is my first experiance with programming and would be grateful of any help!

This is my settings for user variables

PATH=%CommonProgramFiles%\Microsoft Shared\Windows Live (I've not altered this)

This is my settings for system variables

CLASSPATH=.;C:\Program Files\Java\jre6\lib\ext\QTJava.zip (I've not altered this)

PATH=C:\Program Files\Java\jdk1.6.0_21\bin;%CommonProgramFiles%\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\QuickTime\QTSystem\ (This one I added the first bit upto %commonprogramfiles)

JAVA_HOME=C:\Program Files\Java\jdk1.6.0_21 (this one I added the complete line, after reading it somewhere on the forum)

My source code is in C:\Program Files\Java\jdk1.6.0_21\bin (not correct I know but i've many options) which is the same folder as javac.

The file name is party2.java

This is the error code I get

Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All rights reserved.

C:\Users\craig>java -version
java version "1.6.0_21"
Java(TM) SE Runtime Environment (build 1.6.0_21-b07)
Java HotSpot(TM) Client VM (build 17.0-b17, mixed mode, sharing)

C:\Users\craig>cd C:\Program Files\Java\jdk1.6.0_21\bin

C:\Program Files\Java\jdk1.6.0_21\bin>javac party2.java
party2.java:2: ';' expected
import java.awt.event*;
1 error

C:\Program Files\Java\jdk1.6.0_21\bin>

I've been trying to solve this problem for the last 4 days I hope someone can point me in the right direction, don't want t fail at this early stage

Thanks again in advance

W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
Can you show us the code you are trying to compile?

When I die, I want people to look at me and say "Yeah, he might have been crazy, but that was one zarkin frood that knew where his towel was."
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

There should be a . (dot) between event and * in the import.

Regards, Rene Larsen
Dropbox Invite
craig connell

Joined: Sep 21, 2010
Posts: 9
Thanks for the replies, I should of spotted the dot missing. Sadly that wasn't my biggest mistake. The code was incomplete, it wasn't a tutorial just an overview
Sorry about that.
W. Joe Smith
Ranch Hand

Joined: Feb 10, 2009
Posts: 710
No worries! On ething to note about HFJ is not all the code examples will complie; some are just set up to demonstrate a concept. A good way to practice, though, is to write that code yourself then figure out how to make it a runnable program.
craig connell

Joined: Sep 21, 2010
Posts: 9
Will do, cheers
I agree. Here's the link: http://aspose.com/file-tools
subject: Problem with running java complier
It's not a secret anymore!