Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
407 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
[X]
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
  • 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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 500 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

Industry Leaders: 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!

Question has a verified solution.

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

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

618 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