Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Using Java inside of unix environment - trying to resolve a priavte enum character expected error when compiling java file

Posted on 2008-10-01
8
401 Views
Last Modified: 2013-12-26
I got some java code below, and upon trying to compile it in my unix environment, i get the following error
 
()[/home/mgt/gmat]> javac Downloader.java
Downloader.java:37: ';' expected
    private enum ReportFormat {
                              ^
1 error
 
 
This is a portion of the code below
 
   
   
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
import java.security.DigestOutputStream;
import java.security.MessageDigest;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
 
/**
 * Sample GMAT Score Data File Downloader.
 *
 * @version $Revision: #11 $ submitted $DateTime: 2008/08/18 14:43:29 $ by $Author: chetds $
 * @author Dan Syrstad
 */
public class Downloader {
    private static final String HOSTNAME = "www.domainname.com";
    private static final String RELATIVE_URL = "/entry/gmat/download.jsp";
    private static final DateFormat logDateFmt = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss: ");
       
    private static PrintStream logStream = System.out;
    private enum ReportFormat {
        TXT,
        CSV;
    };
       
    // Discourage instantiation
    private Downloader() { }
               
    private static void emitUsageAndExit() {
        log("Usage: Downloader [-file filename] [-log log-file] [-host hostname] [-format [TXT | CSV]] username password GMAT-progr$
        System.exit(1);
    }
               
Where should i put the expected ';'
0
Comment
Question by:chipw93
  • 2
  • 2
  • 2
8 Comments
 
LVL 7

Expert Comment

by:humanonomics
ID: 22615066
Whats the JDK version on your machine >?
0
 

Author Comment

by:chipw93
ID: 22615150
()[/home/mgt/gmat]> java -showversion
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)

Isthat the information you were looking for?
0
 
LVL 62

Expert Comment

by:gheist
ID: 22617398
can you compile using jikes compiler?
You mising two semicolon after }
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:chipw93
ID: 22618307
How would I use the jikes compiler
0
 
LVL 62

Expert Comment

by:gheist
ID: 22619202
Compile on windows. It is not unix error in range -1..-255
0
 
LVL 7

Accepted Solution

by:
humanonomics earned 125 total points
ID: 22621383
Well the problem is the JDK version, "enum" has been added since JDK 1.5/Java 5.0 and you are using an older version, thats why it won't compile. Just install Java 5.0 or higher JDK and JRE and then it will work fine.

Thanks,

humanonomics.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question