• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 408
  • Last Modified:

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

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
chipw93
Asked:
chipw93
  • 2
  • 2
  • 2
1 Solution
 
humanonomicsCommented:
Whats the JDK version on your machine >?
0
 
chipw93Author Commented:
()[/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
 
gheistCommented:
can you compile using jikes compiler?
You mising two semicolon after }
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
chipw93Author Commented:
How would I use the jikes compiler
0
 
gheistCommented:
Compile on windows. It is not unix error in range -1..-255
0
 
humanonomicsCommented:
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now