Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with running java complier

 
craig connell
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you show us the code you are trying to compile?
 
Rene Larsen
Ranch Hand
Posts: 1179
Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There should be a . (dot) between event and * in the import.
 
craig connell
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 710
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Will do, cheers
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic