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
396 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
Comment Utility
Whats the JDK version on your machine >?
0
 

Author Comment

by:chipw93
Comment Utility
()[/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 61

Expert Comment

by:gheist
Comment Utility
can you compile using jikes compiler?
You mising two semicolon after }
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:chipw93
Comment Utility
How would I use the jikes compiler
0
 
LVL 61

Expert Comment

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

Accepted Solution

by:
humanonomics earned 125 total points
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now